File size: 395 Bytes
9bfbd73
7046e94
9bfbd73
1623964
 
2ef5d7f
1623964
d9418bc
1623964
9bfbd73
 
 
1
2
3
4
5
6
7
8
9
10
11
12
import gradio as gr
from transformers import pipeline

def greet(tweet):
    classifier = pipeline('text-classification', model='ancebuc/tweet-eval-sentiment')
    label = classifier(tweet)[0]['label']

    labels = {'LABEL_0': 'Negativo :(', 'LABEL_1': 'Neutro :/', 'LABEL_2': 'Positivo :)'}
    return labels[label]

iface = gr.Interface(fn=greet, inputs="text", outputs="text")
iface.launch()