Julien Simon commited on
Commit
e440ffc
·
1 Parent(s): dabfb10

Update output message

Browse files
Files changed (1) hide show
  1. app.py +5 -2
app.py CHANGED
@@ -4,7 +4,10 @@ from transformers import pipeline
4
  classifier = pipeline("text-classification", model="juliensimon/distilbert-amazon-shoe-reviews")
5
 
6
  def predict(review):
7
- return classifier(review)
 
 
 
8
 
9
  iface = gr.Interface(fn=predict, inputs="text", outputs="text")
10
- iface.launch()
 
4
  classifier = pipeline("text-classification", model="juliensimon/distilbert-amazon-shoe-reviews")
5
 
6
  def predict(review):
7
+ prediction = classifier(review)
8
+ stars = prediction['label'].split('_')[1]
9
+ score = prediction['score']
10
+ return "{} {:.0f}%".format("\U00002B50"*stars, score)
11
 
12
  iface = gr.Interface(fn=predict, inputs="text", outputs="text")
13
+ iface.launch()