Jurk06 commited on
Commit
c488555
·
verified ·
1 Parent(s): 8e5505a

Create app.py

Browse files
Files changed (1) hide show
  1. app.py +19 -0
app.py ADDED
@@ -0,0 +1,19 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ import gradio as gr
2
+ import nltk
3
+ from nltk.sentiment.vader import SentimentIntensityAnalyzer
4
+
5
+ nltk.download("vader_lexicon")
6
+ sid = SentimentIntensityAnalyzer()
7
+
8
+ def sentiment_analysis(text):
9
+ scores = sid.polarity_scores(text)
10
+ del scores["compound"]
11
+ return scores
12
+
13
+ demo = gr.Interface(
14
+ fn=sentiment_analysis,
15
+ inputs=gr.Textbox(placeholder="Enter a positive or negative sentence here..."),
16
+ outputs="label",
17
+ examples=[["This is wonderful!"]])
18
+
19
+ demo.launch()