File size: 630 Bytes
695b214
 
 
 
 
 
e7ecab1
 
 
 
 
 
 
 
695b214
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
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()