Spaces:
Runtime error
Runtime error
Commit ·
72fbd6b
1
Parent(s): 14cf308
fix: predict_fn return bug
Browse files
app.py
CHANGED
|
@@ -38,6 +38,6 @@ def predict_fn(image):
|
|
| 38 |
top_p, top_class = probabilities.topk(1, dim=1)
|
| 39 |
|
| 40 |
# return dictionary whose keys are labels and values are confidences
|
| 41 |
-
return {str(top_class.item())
|
| 42 |
|
| 43 |
gr.Interface(predict_fn, gr.inputs.Image(type="pil", label="Input Image"), outputs="label").launch()
|
|
|
|
| 38 |
top_p, top_class = probabilities.topk(1, dim=1)
|
| 39 |
|
| 40 |
# return dictionary whose keys are labels and values are confidences
|
| 41 |
+
return {str(top_class.item()): str(top_p.item())}
|
| 42 |
|
| 43 |
gr.Interface(predict_fn, gr.inputs.Image(type="pil", label="Input Image"), outputs="label").launch()
|