Spaces:
Runtime error
Runtime error
import requests | |
import streamlit as st | |
import streamlit.components.v1 as components | |
def semanticComparativeClassification(): | |
print('Pregunta ',st.session_state.mytext) | |
#API_URL = "https://api-inference.huggingface.co/models/Maite89/Roberta_finetuning_semantic_similarity_stsb_multi_mt" | |
API_URL = "https://api-inference.huggingface.co/models/symanto/sn-xlm-roberta-base-snli-mnli-anli-xnli" | |
headers = {"Authorization": "Bearer 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"} | |
def query(payload): | |
response = requests.post(API_URL, headers=headers, json=payload) | |
return response.json() | |
output = query({ | |
"inputs": { | |
"wait_for_model" : True, | |
"source_sentence": st.session_state.mytext, | |
"sentences": [ | |
"Conoces Lya2", | |
"He perdido la contraseña", | |
"Calendario de eventos", | |
"Cambios dobles", | |
"Cambios simples" | |
] | |
}, | |
}) | |
for i in output: | |
print(i) | |
return output | |
#x = st.slider('Select a value') | |
#st.write(x, 'squared is', x * x) | |
st.title('Uber pickups in NYC') | |
title = st.text_input('Query', '¿Conoces Lya2?', on_change=semanticComparativeClassification,key='mytext') | |
#st.write('The current movie title is', title) |