Spaces:
Runtime error
Runtime error
from transformers import pipeline | |
import gradio as gr | |
roberta_pipe = pipeline( | |
"sentiment-analysis", | |
model="siebert/sentiment-roberta-large-english", | |
tokenizer="siebert/sentiment-roberta-large-english", | |
return_all_scores = True | |
) | |
def analyse_sentiment(text): | |
response = roberta_pipe(text) | |
d = {} | |
for i in response[0]: | |
d[i['label'].lower()] = i['score'] | |
return d | |
text = gr.Textbox(lines=5, placeholder="Enter Text to Get Sentiment",default="", label="Enter Text") | |
iface = gr.Interface(fn=analyse_sentiment, inputs=[text], outputs="label", title='Roberta Sentiment Analysis') | |
iface.launch(enable_queue=True) |