aliabd commited on
Commit
eb0fa25
·
1 Parent(s): aac8ff5

Upload with huggingface_hub

Browse files
Files changed (2) hide show
  1. README.md +1 -2
  2. run.py +20 -0
README.md CHANGED
@@ -6,7 +6,6 @@ colorFrom: indigo
6
  colorTo: indigo
7
  sdk: gradio
8
  sdk_version: 3.4.1
9
-
10
- app_file: app.py
11
  pinned: false
12
  ---
 
6
  colorTo: indigo
7
  sdk: gradio
8
  sdk_version: 3.4.1
9
+ app_file: run.py
 
10
  pinned: false
11
  ---
run.py ADDED
@@ -0,0 +1,20 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
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
+ interpretation="default",
18
+ examples=[["This is wonderful!"]])
19
+
20
+ demo.launch()