Commit ·
ef5a3d9
1
Parent(s): 2e1afe5
Create app.py
Browse files
app.py
ADDED
|
@@ -0,0 +1,14 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
import gradio as gr
|
| 2 |
+
from nltk.sentiment.vader import SentimentIntensityAnalyzer
|
| 3 |
+
|
| 4 |
+
def sentiment_analysis(sentiment_text):
|
| 5 |
+
score = SentimentIntensityAnalyzer().polarity_scores(sentiment_text)
|
| 6 |
+
if score['neg']>score['pos']:
|
| 7 |
+
return "Negative Feedback"
|
| 8 |
+
elif score['neg']<score['pos']:
|
| 9 |
+
return "Positive Feedback"
|
| 10 |
+
else:
|
| 11 |
+
return "Neutral Feedback"
|
| 12 |
+
|
| 13 |
+
iface = gr.Interface(fn = sentiment_analysis , inputs=['text'] , outputs=['text'])
|
| 14 |
+
iface.launch()
|