Spaces:
Sleeping
Sleeping
| import gradio as gr | |
| from transformers import pipeline | |
| # Load our model (this will happen when the app starts) | |
| sentiment_pipeline = pipeline("sentiment-analysis") | |
| # Create a function that Gradio can use | |
| def get_sentiment(input_text): | |
| result = sentiment_pipeline(input_text) | |
| return result[0]['label'] # Just return the label (POSITIVE or NEGATIVE) | |
| # Launch the web UI | |
| iface = gr.Interface( | |
| fn=get_sentiment, | |
| inputs="text", | |
| outputs="text", | |
| title="My First AI App", | |
| description="Enter some text and I'll tell you if it's positive or negative." | |
| ) | |
| iface.launch(share=True) |