Spaces:
Runtime error
Runtime error
Commit
·
39fa7a9
1
Parent(s):
dc07155
Update app.py
Browse files
app.py
CHANGED
@@ -26,7 +26,7 @@ def predict(img):
|
|
26 |
probability = torch.nn.functional.softmax(out[0],dim=0)
|
27 |
|
28 |
values, indices = torch.topk(probability,k=5)
|
29 |
-
return {LABELS[i]: v.
|
30 |
|
31 |
|
32 |
iface = gr.Interface(fn=predict, inputs=gr.inputs.Image(type='pil'), outputs="label").launch()
|
|
|
26 |
probability = torch.nn.functional.softmax(out[0],dim=0)
|
27 |
|
28 |
values, indices = torch.topk(probability,k=5)
|
29 |
+
return {LABELS[i]: v.item() for i,v in zip(indices,values)}
|
30 |
|
31 |
|
32 |
iface = gr.Interface(fn=predict, inputs=gr.inputs.Image(type='pil'), outputs="label").launch()
|