Spaces:
Sleeping
Sleeping
Create app.py
Browse files
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()
|