Spaces:
Runtime error
Runtime error
Update app.py
Browse files
app.py
CHANGED
@@ -1,23 +1,18 @@
|
|
1 |
import requests
|
2 |
import streamlit as st
|
3 |
import streamlit.components.v1 as components
|
4 |
-
|
|
|
|
|
|
|
5 |
def semanticComparativeClassification():
|
6 |
st.write(st.session_state.mytext)
|
7 |
|
8 |
#API_URL = "https://api-inference.huggingface.co/models/Maite89/Roberta_finetuning_semantic_similarity_stsb_multi_mt"
|
9 |
API_URL = "https://api-inference.huggingface.co/models/symanto/sn-xlm-roberta-base-snli-mnli-anli-xnli"
|
10 |
headers = {"Authorization": "Bearer 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"}
|
11 |
-
|
12 |
-
|
13 |
-
response = requests.post(API_URL, headers=headers, json=payload)
|
14 |
-
return response.json()
|
15 |
-
|
16 |
-
output = query({
|
17 |
-
"inputs": {
|
18 |
-
"wait_for_model" : True,
|
19 |
-
"source_sentence": st.session_state.mytext,
|
20 |
-
"sentences": [
|
21 |
"Conoces Lya2",
|
22 |
"He perdido la contrase帽a",
|
23 |
"Calendario de eventos",
|
@@ -26,6 +21,12 @@ def semanticComparativeClassification():
|
|
26 |
"Hola me est谩s saludando",
|
27 |
"Adi贸s te despides"
|
28 |
]
|
|
|
|
|
|
|
|
|
|
|
|
|
29 |
},
|
30 |
})
|
31 |
index = 0
|
@@ -37,7 +38,7 @@ def semanticComparativeClassification():
|
|
37 |
sentenceindex = index
|
38 |
index = index + 1
|
39 |
|
40 |
-
st.write("Hablamos de ",
|
41 |
|
42 |
return output
|
43 |
|
|
|
1 |
import requests
|
2 |
import streamlit as st
|
3 |
import streamlit.components.v1 as components
|
4 |
+
def query(payload):
|
5 |
+
response = requests.post(API_URL, headers=headers, json=payload)
|
6 |
+
return response.json()
|
7 |
+
|
8 |
def semanticComparativeClassification():
|
9 |
st.write(st.session_state.mytext)
|
10 |
|
11 |
#API_URL = "https://api-inference.huggingface.co/models/Maite89/Roberta_finetuning_semantic_similarity_stsb_multi_mt"
|
12 |
API_URL = "https://api-inference.huggingface.co/models/symanto/sn-xlm-roberta-base-snli-mnli-anli-xnli"
|
13 |
headers = {"Authorization": "Bearer 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"}
|
14 |
+
|
15 |
+
sentences = [
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
16 |
"Conoces Lya2",
|
17 |
"He perdido la contrase帽a",
|
18 |
"Calendario de eventos",
|
|
|
21 |
"Hola me est谩s saludando",
|
22 |
"Adi贸s te despides"
|
23 |
]
|
24 |
+
|
25 |
+
output = query({
|
26 |
+
"inputs": {
|
27 |
+
"wait_for_model" : True,
|
28 |
+
"source_sentence": st.session_state.mytext,
|
29 |
+
"sentences": sentences
|
30 |
},
|
31 |
})
|
32 |
index = 0
|
|
|
38 |
sentenceindex = index
|
39 |
index = index + 1
|
40 |
|
41 |
+
st.write("Hablamos de ", sentences[sentenceindex])
|
42 |
|
43 |
return output
|
44 |
|