graredcr commited on
Commit
ea1d70b
·
1 Parent(s): 61c76fc

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +6 -10
app.py CHANGED
@@ -7,11 +7,8 @@ st.session_state.mytext = ""
7
  global logtxt
8
  global logtxtbox
9
  logtxt = ""
10
- def semanticComparativeClassification():
11
- global logtxt
12
- global logtxtbox
13
- st.session_state["respuesta"] = ""
14
- st.session_state.logresp = ""
15
 
16
 
17
  apis_urls = [
@@ -26,7 +23,7 @@ def semanticComparativeClassification():
26
 
27
 
28
  def semanticComparativeClassificationCall(api_url: str):
29
- st.session_state.logresp = st.session_state.logresp + "Model: "+api_url+"\n"
30
  time.sleep(1)
31
  headers = {"Authorization": "Bearer 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"}
32
  #API_URL = "https://api-inference.huggingface.co/models/Maite89/Roberta_finetuning_semantic_similarity_stsb_multi_mt"
@@ -66,20 +63,19 @@ def semanticComparativeClassificationCall(api_url: str):
66
  },
67
  })
68
 
69
- #st.write(output)
70
  if "error" in output:
71
  st.write(output["error"])
72
  else:
73
  index=0
74
  for i in output:
75
- st.write( st.session_state.logresp+ str(i) +' - '+sentences[index])
76
  #container.write(i," - ", sentences[index])
77
  index = index + 1
78
  maxim = max(output)
79
 
80
  sentenceindex = output.index(maxim)
81
-
82
- st.write(st.session_state.logresp+str(sentenceindex))
83
 
84
  if output[sentenceindex] < 0.3 :
85
  st.write( "\nNo tengo respuesta para esto, ¿me lo explicas mejor o te pongo en contacto con un humano? ")
 
7
  global logtxt
8
  global logtxtbox
9
  logtxt = ""
10
+ def semanticComparativeClassification():
11
+ st.session_state["respuesta"] = ""
 
 
 
12
 
13
 
14
  apis_urls = [
 
23
 
24
 
25
  def semanticComparativeClassificationCall(api_url: str):
26
+ st.write("Model: "+api_url+"\n")
27
  time.sleep(1)
28
  headers = {"Authorization": "Bearer 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"}
29
  #API_URL = "https://api-inference.huggingface.co/models/Maite89/Roberta_finetuning_semantic_similarity_stsb_multi_mt"
 
63
  },
64
  })
65
 
66
+ st.write(output)
67
  if "error" in output:
68
  st.write(output["error"])
69
  else:
70
  index=0
71
  for i in output:
72
+ st.write( str(i) +' - '+sentences[index])
73
  #container.write(i," - ", sentences[index])
74
  index = index + 1
75
  maxim = max(output)
76
 
77
  sentenceindex = output.index(maxim)
78
+
 
79
 
80
  if output[sentenceindex] < 0.3 :
81
  st.write( "\nNo tengo respuesta para esto, ¿me lo explicas mejor o te pongo en contacto con un humano? ")