Spaces:
Runtime error
Runtime error
Commit ·
63232cc
1
Parent(s): 1fbdaef
Update app.py
Browse files
app.py
CHANGED
|
@@ -54,7 +54,7 @@ def image_classifier(input_image, top_classes=3, show_cam=True, target_layers=[2
|
|
| 54 |
o = softmax(output.flatten())
|
| 55 |
|
| 56 |
confidences = {classes[i]: float(o[i]) for i in range(10)}
|
| 57 |
-
confidences_sorted = sorted(confidences.items(), key=lambda x:x[1],reverse=True)
|
| 58 |
#confidences = dict(list(confidences_sorted.items())[0: top_classes])
|
| 59 |
confidences = {k: confidences_sorted[k] for k in list(confidences_sorted)[:top_classes]}
|
| 60 |
_, label = torch.max(output, 1)
|
|
|
|
| 54 |
o = softmax(output.flatten())
|
| 55 |
|
| 56 |
confidences = {classes[i]: float(o[i]) for i in range(10)}
|
| 57 |
+
confidences_sorted = dict(sorted(confidences.items(), key=lambda x:x[1],reverse=True))
|
| 58 |
#confidences = dict(list(confidences_sorted.items())[0: top_classes])
|
| 59 |
confidences = {k: confidences_sorted[k] for k in list(confidences_sorted)[:top_classes]}
|
| 60 |
_, label = torch.max(output, 1)
|