Spaces:
Runtime error
Runtime error
Commit ·
9631ed9
1
Parent(s): e739698
Update app.py
Browse files
app.py
CHANGED
|
@@ -66,7 +66,7 @@ def image_classifier(input_image, top_classes=3, show_cam=True, target_layers=[2
|
|
| 66 |
for layer in target_layers:
|
| 67 |
grayscale_cam = get_gradcam_image(input_image, label, layer)
|
| 68 |
output_image = show_cam_on_image(orig_image / 255, grayscale_cam, use_rgb=True, image_weight=transparency)
|
| 69 |
-
outputs.append((output_image, f"Layer {layer -
|
| 70 |
|
| 71 |
return outputs, confidences
|
| 72 |
|
|
@@ -93,8 +93,8 @@ def show_incorrect(num_examples=10):
|
|
| 93 |
for i in range(num_examples):
|
| 94 |
j = np.random.randint(0,wrong_img_no)
|
| 95 |
image = np.asarray(Image.open(f'misclassified-images/{j}.jpg'))
|
| 96 |
-
actual = classes(
|
| 97 |
-
predicted = classes(wrong_img[
|
| 98 |
|
| 99 |
result.append((image, f"{actual} / {predicted}"))
|
| 100 |
|
|
|
|
| 66 |
for layer in target_layers:
|
| 67 |
grayscale_cam = get_gradcam_image(input_image, label, layer)
|
| 68 |
output_image = show_cam_on_image(orig_image / 255, grayscale_cam, use_rgb=True, image_weight=transparency)
|
| 69 |
+
outputs.append((output_image, f"Layer {layer - 5}"))
|
| 70 |
|
| 71 |
return outputs, confidences
|
| 72 |
|
|
|
|
| 93 |
for i in range(num_examples):
|
| 94 |
j = np.random.randint(0,wrong_img_no)
|
| 95 |
image = np.asarray(Image.open(f'misclassified-images/{j}.jpg'))
|
| 96 |
+
actual = classes(wrong_imgloc[0].at["actual"])
|
| 97 |
+
predicted = classes(wrong_img.loc[0].at["predicted"])
|
| 98 |
|
| 99 |
result.append((image, f"{actual} / {predicted}"))
|
| 100 |
|