Spaces:
Sleeping
Sleeping
| from transformers import pipeline | |
| import gradio as gr | |
| pipe = pipeline("sentiment-analysis") | |
| def get_sentiment(input): | |
| prediction = pipe(input) | |
| label = prediction[0]['label'] | |
| score = prediction[0]['score'] | |
| return f'{label} {score * 100:.2f}%' | |
| demo = gr.Interface( | |
| fn=get_sentiment, | |
| inputs="text", | |
| outputs="text", | |
| title="Sentiment Analysis", | |
| description="Get a sentimental analysis for the provided text" | |
| ) | |
| demo.launch() |