Spaces:
Runtime error
Runtime error
Update app.py
Browse files
app.py
CHANGED
@@ -2,7 +2,9 @@ import requests
|
|
2 |
import streamlit as st
|
3 |
import streamlit.components.v1 as components
|
4 |
|
|
|
5 |
def semanticComparativeClassification():
|
|
|
6 |
API_URL = "https://api-inference.huggingface.co/models/symanto/sn-xlm-roberta-base-snli-mnli-anli-xnli"
|
7 |
headers = {"Authorization": "Bearer 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"}
|
8 |
#API_URL = "https://api-inference.huggingface.co/models/Maite89/Roberta_finetuning_semantic_similarity_stsb_multi_mt"
|
@@ -39,7 +41,7 @@ def semanticComparativeClassification():
|
|
39 |
},
|
40 |
})
|
41 |
|
42 |
-
st.write(output)
|
43 |
|
44 |
index=0
|
45 |
for i in output:
|
@@ -48,13 +50,13 @@ def semanticComparativeClassification():
|
|
48 |
|
49 |
sentenceindex = output.index(max(output))
|
50 |
|
51 |
-
if output[sentenceindex] < 0.
|
52 |
st.write("No tengo respuesta para esto, ¿me lo explicas mejor o te pongo en contacto con un humano?")
|
|
|
53 |
else:
|
54 |
st.write("Hablamos de ", str(sentences[sentenceindex]))
|
55 |
-
|
56 |
-
|
57 |
-
return output
|
58 |
|
59 |
|
60 |
#x = st.slider('Select a value')
|
@@ -63,4 +65,6 @@ def semanticComparativeClassification():
|
|
63 |
|
64 |
|
65 |
st.title('Reconocimiento semántico')
|
66 |
-
title = st.text_input('Pregunta', 'Hazme una pregunta', on_change=semanticComparativeClassification,key='mytext')
|
|
|
|
|
|
2 |
import streamlit as st
|
3 |
import streamlit.components.v1 as components
|
4 |
|
5 |
+
response = ""
|
6 |
def semanticComparativeClassification():
|
7 |
+
global response
|
8 |
API_URL = "https://api-inference.huggingface.co/models/symanto/sn-xlm-roberta-base-snli-mnli-anli-xnli"
|
9 |
headers = {"Authorization": "Bearer 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"}
|
10 |
#API_URL = "https://api-inference.huggingface.co/models/Maite89/Roberta_finetuning_semantic_similarity_stsb_multi_mt"
|
|
|
41 |
},
|
42 |
})
|
43 |
|
44 |
+
#st.write(output)
|
45 |
|
46 |
index=0
|
47 |
for i in output:
|
|
|
50 |
|
51 |
sentenceindex = output.index(max(output))
|
52 |
|
53 |
+
if output[sentenceindex] < 0.3 :
|
54 |
st.write("No tengo respuesta para esto, ¿me lo explicas mejor o te pongo en contacto con un humano?")
|
55 |
+
response = "No tengo respuesta para esto, ¿me lo explicas mejor o te pongo en contacto con un humano?"
|
56 |
else:
|
57 |
st.write("Hablamos de ", str(sentences[sentenceindex]))
|
58 |
+
response = str(sentences[sentenceindex])
|
59 |
+
|
|
|
60 |
|
61 |
|
62 |
#x = st.slider('Select a value')
|
|
|
65 |
|
66 |
|
67 |
st.title('Reconocimiento semántico')
|
68 |
+
title = st.text_input('Pregunta', 'Hazme una pregunta', on_change=semanticComparativeClassification,key='mytext')
|
69 |
+
|
70 |
+
st.write( response )
|