Spaces:
Runtime error
Runtime error
Commit ·
1fbdaef
1
Parent(s): c33e678
Update app.py
Browse files
app.py
CHANGED
|
@@ -55,7 +55,8 @@ def image_classifier(input_image, top_classes=3, show_cam=True, target_layers=[2
|
|
| 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 |
_, label = torch.max(output, 1)
|
| 60 |
|
| 61 |
outputs = list()
|
|
|
|
| 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)
|
| 61 |
|
| 62 |
outputs = list()
|