Spaces:
Sleeping
Sleeping
| import transformers | |
| import gradio as gr | |
| from transformers import pipeline | |
| sentiment =pipeline("text-classification", model="tabularisai/multilingual-sentiment-analysis") | |
| # Classify a new sentence | |
| sentence = "I love this product! It's amazing and works perfectly." | |
| result = sentiment(sentence) | |
| def get_sentiment(text): | |
| result = sentiment(text) | |
| label = result[0]['label'] | |
| score = result[0]['score'] | |
| return label, score | |
| interface = gr.Interface(fn=get_sentiment, inputs= "textbox", outputs=["text","text"]) | |
| interface.launch() |