Spaces:
Sleeping
Sleeping
Update app.py
Browse files
app.py
CHANGED
|
@@ -7,13 +7,14 @@ learn = load_learner('food_classif_model_v1.pkl')
|
|
| 7 |
def predict_image(img):
|
| 8 |
pred,los,prob = learn.predict(img)
|
| 9 |
top_values, top_indx = torch.topk(prob, 3) # show 3 max values
|
| 10 |
-
|
|
|
|
| 11 |
|
| 12 |
-
if (top_values < 0.4).all():
|
| 13 |
-
|
| 14 |
-
else:
|
| 15 |
-
|
| 16 |
-
return text_out
|
| 17 |
|
| 18 |
|
| 19 |
# UI huggface
|
|
|
|
| 7 |
def predict_image(img):
|
| 8 |
pred,los,prob = learn.predict(img)
|
| 9 |
top_values, top_indx = torch.topk(prob, 3) # show 3 max values
|
| 10 |
+
return pred
|
| 11 |
+
# text_out = ''
|
| 12 |
|
| 13 |
+
# if (top_values < 0.4).all():
|
| 14 |
+
# text_out = 'I do not know what is that'
|
| 15 |
+
# else:
|
| 16 |
+
# text_out = f'{food_indx[top_indx[0]]} = {top_values[0]}\n{food_indx[top_indx[1]]} = {top_values[1]}\n{food_indx[top_indx[2]]} = {top_values[2]}'
|
| 17 |
+
# return text_out
|
| 18 |
|
| 19 |
|
| 20 |
# UI huggface
|