graredcr commited on
Commit
e0f9860
·
1 Parent(s): b4bc03a

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +19 -17
app.py CHANGED
@@ -53,25 +53,27 @@ def semanticComparativeClassificationCall(api_url: str):
53
  })
54
 
55
  st.write(output)
 
 
 
 
 
 
 
 
 
 
 
56
 
57
- index=0
58
- for i in output:
59
- st.write(i," - ", sentences[index])
60
- index = index + 1
61
- maxim = max(output)
62
- st.write('MAX:', str(maxim))
63
 
64
- sentenceindex = output.index(maxim)
65
-
66
- st.write('Sentence index :', sentenceindex)
67
-
68
- if output[sentenceindex] < 0.3 :
69
- st.write("No tengo respuesta para esto, ¿me lo explicas mejor o te pongo en contacto con un humano?")
70
- st.session_state["respuesta"]= st.session_state["respuesta"] +api_url+"\nNo tengo respuesta para esto, ¿me lo explicas mejor o te pongo en contacto con un humano?"+"\n\n"
71
- else:
72
- st.write("Tema reconocido: ", str(sentences[sentenceindex]))
73
- st.session_state["respuesta"]= st.session_state["respuesta"] +api_url+"\nTema reconocido: \n"+str(sentences[sentenceindex])+"\n\n"
74
-
75
 
76
 
77
 
 
53
  })
54
 
55
  st.write(output)
56
+ if "error" in output:
57
+ print("Error en la carga del modelo")
58
+ else:
59
+ index=0
60
+ for i in output:
61
+ st.write(i," - ", sentences[index])
62
+ index = index + 1
63
+ maxim = max(output)
64
+ st.write('MAX:', str(maxim))
65
+
66
+ sentenceindex = output.index(maxim)
67
 
68
+ st.write('Sentence index :', sentenceindex)
 
 
 
 
 
69
 
70
+ if output[sentenceindex] < 0.3 :
71
+ st.write("No tengo respuesta para esto, ¿me lo explicas mejor o te pongo en contacto con un humano?")
72
+ st.session_state["respuesta"]= st.session_state["respuesta"] +api_url+"\nNo tengo respuesta para esto, ¿me lo explicas mejor o te pongo en contacto con un humano?"+"\n\n"
73
+ else:
74
+ st.write("Tema reconocido: ", str(sentences[sentenceindex]))
75
+ st.session_state["respuesta"]= st.session_state["respuesta"] +api_url+"\nTema reconocido: \n"+str(sentences[sentenceindex])+"\n\n"
76
+
 
 
 
 
77
 
78
 
79