Spaces:
Sleeping
Sleeping
| from textblob import TextBlob | |
| import gradio as gr | |
| def classify_sentiment(text): | |
| blob = TextBlob(text) | |
| polarity = blob.sentiment.polarity | |
| if polarity > 0: | |
| return "Positive" | |
| elif polarity < 0: | |
| return "Negative" | |
| else: | |
| return "Neutral" | |
| demo = gr.Interface( | |
| fn=classify_sentiment, | |
| inputs=gr.Textbox(lines=2, placeholder="Type your sentence here..."), | |
| outputs="text", | |
| title="Sentiment Analysis App", | |
| description="Classify text into Positive, Negative, or Neutral using TextBlob." | |
| ) | |
| if __name__ == "__main__": | |
| demo.launch() |