Spaces:
Sleeping
Sleeping
File size: 592 Bytes
14f56c8 bc8c312 14f56c8 |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 |
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() |