GloryIX commited on
Commit
d1c7ef6
·
verified ·
1 Parent(s): 7703f9b

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +23 -0
app.py CHANGED
@@ -0,0 +1,23 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ import gradio as gr
2
+ from transformers import pipeline
3
+
4
+ sentiment = pipeline("sentiment-analysis")
5
+
6
+ def get_sentiment(input_text):
7
+ analysis = sentiment(input_text)
8
+ sent = analysis[0]['label']
9
+ score = analysis[0]['score']
10
+ return sent, score
11
+
12
+
13
+ textbox = gr.Textbox(label="Enter the review:")
14
+ interface = gr.Interface(
15
+ fn=get_sentiment,
16
+ inputs=textbox ,
17
+ outputs=[
18
+ gr.Textbox(label="Sentiment"),
19
+ gr.Number(label="Score")
20
+ ],
21
+ title="Sentiment analysis protoype",
22
+ )
23
+ interface.launch()