Spaces:
Sleeping
Sleeping
| import gradio as gr | |
| from textblob import TextBlob | |
| def analyze_sentiment(text): | |
| sentiment = TextBlob(text).sentiment.polarity | |
| if sentiment > 0: | |
| return "Positive" | |
| elif sentiment < 0: | |
| return "Negative" | |
| else: | |
| return "Neutral" | |
| iface = gr.Interface( | |
| fn=analyze_sentiment, | |
| inputs=gr.Textbox(lines=3,placeholder="Enter the sentence you want to analyze:"), | |
| outputs="text", | |
| title="Sentiment Analysis", | |
| description="Enter a sentence, and the AI will predict its sentiment." | |
| ) | |
| iface.launch() |