sahiba12 commited on
Commit
f178f66
1 Parent(s): 816472c

Create app.py

Browse files
Files changed (1) hide show
  1. app.py +20 -0
app.py ADDED
@@ -0,0 +1,20 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ import nltk
2
+
3
+ from nltk.sentiment.vader import SentimentIntensityAnalyzer
4
+
5
+ import gradio as gr
6
+
7
+
8
+ nltk.download("vader_lexicon")
9
+ sid = SentimentIntensityAnalyzer()
10
+
11
+ def sentiment_analysis(text):
12
+ scores = sid.polarity_scores(text)
13
+ del scores["compound"]
14
+ return scores
15
+
16
+ iface = gr.Interface(sentiment_analysis, "textbox", "label", interpretation="default")
17
+
18
+ iface.test_launch()
19
+ if __name__ == "__main__":
20
+ iface.launch()