Sathiyapramod commited on
Commit
7a9d9b0
·
verified ·
1 Parent(s): 23703ce

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +11 -4
app.py CHANGED
@@ -6,12 +6,19 @@ classifiers = pipeline(
6
  model="distilbert/distilbert-base-uncased-finetuned-sst-2-english",
7
  )
8
 
9
- def greet(name):
10
- return classifiers(name)[0]
 
 
 
 
11
 
12
  demo = gr.Interface(
13
- fn=greet,
14
  inputs="textbox",
15
- outputs=[gr.Textbox(label="Expected output",lines=2)]
 
 
 
16
  )
17
  demo.launch()
 
6
  model="distilbert/distilbert-base-uncased-finetuned-sst-2-english",
7
  )
8
 
9
+ def predict_my_sentiment(name):
10
+ prediction = classifiers(name)[0]
11
+ label = prediction['label']
12
+ score = prediction['score']
13
+
14
+ return label,score
15
 
16
  demo = gr.Interface(
17
+ fn=predict_my_sentiment,
18
  inputs="textbox",
19
+ outputs=[
20
+ gr.Textbox(label="Sentiment Label"),
21
+ gr.Number(label="Confidence Score")
22
+ ]
23
  )
24
  demo.launch()