Tayyaba888 commited on
Commit
2223b50
ยท
verified ยท
1 Parent(s): b345b3d

requirement.txt

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
+
3
+ positive_words = ["good", "great", "happy", "love", "awesome", "fantastic", "excellent", "amazing"]
4
+ negative_words = ["bad", "sad", "terrible", "hate", "awful", "worst", "horrible", "disappointing"]
5
+
6
+ def analyze_sentiment(text):
7
+ text = text.lower()
8
+ pos_count = sum(word in text for word in positive_words)
9
+ neg_count = sum(word in text for word in negative_words)
10
+
11
+ if pos_count > neg_count:
12
+ return "Positive ๐Ÿ˜Š"
13
+ elif neg_count > pos_count:
14
+ return "Negative ๐Ÿ˜ž"
15
+ else:
16
+ return "Neutral ๐Ÿ˜"
17
+
18
+ demo = gr.Interface(fn=analyze_sentiment,
19
+ inputs="text",
20
+ outputs="text",
21
+ title="Simple Sentiment Analyzer")
22
+
23
+ demo.launch()