Spaces:
Sleeping
Sleeping
| from transformers import pipeline | |
| import gradio as gr | |
| classifer = pipeline("sentiment-analysis", model="distilbert-base-uncased-finetuned-sst-2-english") | |
| def analyze_sentiment(text): | |
| result = classifer(text)[0]; | |
| return f"Label: {result['label']}, Score: {result['score']}" | |
| iface = gr.Interface(fn=analyze_sentiment, | |
| inputs=gr.Textbox(lines=2, placeholder="Enter text to analyze sentiment here..."), | |
| outputs="text", | |
| title="Sentiment Analysis", | |
| description="Classify text as positive or negative sentiment using a pre-trained model DistilBert.") | |
| # iface.launch(share=True) | |
| iface.launch() |