Spaces:
Running
Running
Update app.py
Browse files
app.py
CHANGED
|
@@ -43,7 +43,7 @@ def get_metadata(model_id):
|
|
| 43 |
|
| 44 |
def get_prediction(model_id):
|
| 45 |
|
| 46 |
-
classifier = pipeline("text-classification", model=model_id)
|
| 47 |
|
| 48 |
def predict(review):
|
| 49 |
prediction = classifier(review)
|
|
@@ -52,7 +52,7 @@ def get_prediction(model_id):
|
|
| 52 |
# stars = (int)(stars.split('_')[1])+1
|
| 53 |
# score = 100*prediction[0]['score']
|
| 54 |
# return "{} {:.0f}%".format("\U00002B50"*stars, score)
|
| 55 |
-
|
| 56 |
return predict
|
| 57 |
|
| 58 |
with app:
|
|
|
|
| 43 |
|
| 44 |
def get_prediction(model_id):
|
| 45 |
|
| 46 |
+
classifier = pipeline("text-classification", model=model_id, return_all_scores=True)
|
| 47 |
|
| 48 |
def predict(review):
|
| 49 |
prediction = classifier(review)
|
|
|
|
| 52 |
# stars = (int)(stars.split('_')[1])+1
|
| 53 |
# score = 100*prediction[0]['score']
|
| 54 |
# return "{} {:.0f}%".format("\U00002B50"*stars, score)
|
| 55 |
+
return prediction
|
| 56 |
return predict
|
| 57 |
|
| 58 |
with app:
|