ser-estar / app.py
joheras's picture
Update app.py
e7ecab1 verified
raw
history blame contribute delete
630 Bytes
import gradio as gr
from transformers import pipeline
classifier = pipeline('text-classification', model='joheras/clasificador-ser-estar-cambiadas-con-error-bert-base-v2')
def classify(sentence):
result = classifier(sentence)[0]
label,score = result['label'],result['score']
if label == 'Sí':
result = {'Sí':score,'No':1-score}
else:
result = {'No':score,'Sí':1-score}
return result
demo = gr.Interface(fn=classify, inputs="text", outputs="label", examples=["Ellas compraron un saco de patatas", "Ellas eran jugando con sus amigas", "Ellas estaban jugando con sus amigas"])
demo.launch()