scorpion237 commited on
Commit
e73e52d
1 Parent(s): 2a92623

Create app.py

Browse files
Files changed (1) hide show
  1. app.py +16 -0
app.py ADDED
@@ -0,0 +1,16 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ import gradio as gr
2
+ from transformers import pipeline
3
+
4
+ sentiment = pipeline("sentiment-analysis")
5
+
6
+ def get_sentiment(input_text):
7
+ result = sentiment(input_text)
8
+ final = result[0]["label"]
9
+ if final == "POSITIVE":
10
+ return "POSITIVE SENTIMENT"
11
+ else:
12
+ return "NEGATIVE SENTIMENT"
13
+
14
+
15
+ app = gr.Interface(fn=get_sentiment, inputs=gr.components.Textbox(), outputs="text")
16
+ app.launch()