KSAbbas commited on
Commit
5e68ba6
·
verified ·
1 Parent(s): 5ab9a3d

Create app.py

Browse files
Files changed (1) hide show
  1. app.py +23 -0
app.py ADDED
@@ -0,0 +1,23 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ import gradio as gr
2
+ from vaderSentiment.vaderSentiment import SentimentIntensityAnalyzer
3
+
4
+ analyzer = SentimentIntensityAnalyzer()
5
+
6
+ def analyze_sentiment(text):
7
+ score = analyzer.polarity_scores(text)['compound']
8
+ if score >= 0.05:
9
+ return "😊 Positive"
10
+ elif score <= -0.05:
11
+ return "😠 Negative"
12
+ else:
13
+ return "😐 Neutral"
14
+
15
+ iface = gr.Interface(
16
+ fn=analyze_sentiment,
17
+ inputs="text",
18
+ outputs="text",
19
+ title="Simple Sentiment Analysis",
20
+ description="Enter text to analyze sentiment (Positive, Negative, Neutral)."
21
+ )
22
+
23
+ iface.launch()