Spaces:
Runtime error
Runtime error
Update app.py
Browse files
app.py
CHANGED
@@ -47,7 +47,7 @@ def inference(input_image):
|
|
47 |
with open("dog_cat.txt", "r") as f:
|
48 |
categories = [s.strip() for s in f.readlines()]
|
49 |
# Show top categories per image
|
50 |
-
top5_prob, top5_catid = torch.topk(probabilities,
|
51 |
result = {}
|
52 |
for i in range(top5_prob.size(0)):
|
53 |
result[categories[top5_catid[i]]] = top5_prob[i].item()
|
|
|
47 |
with open("dog_cat.txt", "r") as f:
|
48 |
categories = [s.strip() for s in f.readlines()]
|
49 |
# Show top categories per image
|
50 |
+
top5_prob, top5_catid = torch.topk(probabilities, 2)
|
51 |
result = {}
|
52 |
for i in range(top5_prob.size(0)):
|
53 |
result[categories[top5_catid[i]]] = top5_prob[i].item()
|