Spaces:
Sleeping
Sleeping
| import gradio as gr | |
| from transformers import pipeline | |
| # Load pipeline | |
| pipe = pipeline("sentiment-analysis") | |
| # pipe = pipeline("text-classification", model="ProsusAI/finbert") | |
| # Define function for prediction | |
| def analyze(text): | |
| return pipe(text) | |
| # Build Gradio Interface | |
| demo = gr.Interface( | |
| fn=analyze, | |
| inputs=gr.Textbox(label="Enter your input:", lines=3, placeholder="Type text here..."), | |
| outputs=gr.JSON(label="Result"), | |
| title="Sentiment Analysis", | |
| description="Enter text and get sentiment analysis using Hugging Face Transformers." | |
| ) | |
| # Launch | |
| demo.launch() |