Spaces:
Sleeping
Sleeping
| import gradio as gr | |
| from transformers import pipeline | |
| classifier = pipeline( | |
| "sentiment-analysis", | |
| model="ganesh435/my-first-model" | |
| ) | |
| def analyze(text): | |
| result = classifier(text)[0] | |
| return f"Label: {result['label']} | Score: {result['score']:.4f}" | |
| app = gr.Interface( | |
| fn=analyze, | |
| inputs=gr.Textbox(lines=3, placeholder="Type a sentence..."), | |
| outputs="text", | |
| title="Sentiment Analysis App", | |
| description="This app uses a Hugging Face model to analyze sentiment." | |
| ) | |
| app.launch() | |