Spaces:
Sleeping
Sleeping
Update app.py
Browse files
app.py
CHANGED
@@ -43,7 +43,7 @@ def classify_image(image):
|
|
43 |
probabilities, indices = torch.topk(outputs, k=3) # top 3 predictions
|
44 |
probabilities = torch.nn.functional.softmax(probabilities, dim=1)
|
45 |
predictions = [(class_names[idx], prob.item()) for idx, prob in zip(indices[0], probabilities[0])]
|
46 |
-
return {class_name:
|
47 |
|
48 |
|
49 |
examples_path = './examples'
|
|
|
43 |
probabilities, indices = torch.topk(outputs, k=3) # top 3 predictions
|
44 |
probabilities = torch.nn.functional.softmax(probabilities, dim=1)
|
45 |
predictions = [(class_names[idx], prob.item()) for idx, prob in zip(indices[0], probabilities[0])]
|
46 |
+
return {class_name: prob for class_name, prob in predictions}
|
47 |
|
48 |
|
49 |
examples_path = './examples'
|