Spaces:
Sleeping
Sleeping
from transformers import pipeline | |
import gradio as gr | |
pipe = pipeline("text-classification", model="nlptown/bert-base-multilingual-uncased-sentiment") | |
def sentiment_analysis(inputText): | |
result = pipe(inputText) | |
return result[0]['label'] | |
examples = [ | |
["I love this product! It's amazing!"], | |
["This was the worst experience I've ever had."], | |
["The movie was okay, not great but not bad either."], | |
["Absolutely fantastic! I would recommend it to everyone."], | |
] | |
iface = gr.Interface( | |
fn=sentiment_analysis, | |
examples=examples, | |
inputs=gr.Textbox(label='Enter a text to analyze'), | |
outputs=gr.Textbox(label='Sentiment') | |
) | |
iface.launch() | |