Spaces:
Runtime error
Runtime error
Commit ·
518328e
1
Parent(s): aa71af4
Update app.py
Browse files
app.py
CHANGED
|
@@ -50,8 +50,8 @@ def get_gradcam_image(input_tensor, label, target_layer):
|
|
| 50 |
|
| 51 |
|
| 52 |
def image_classifier(input_image, top_classes=3, show_cam=True, target_layers=[2, 3], transparency=0.5):
|
| 53 |
-
input_image = transform(input_image).unsqueeze(0)
|
| 54 |
-
|
| 55 |
output = model(input_image)
|
| 56 |
output = F.softmax(output.flatten(), dim=-1)
|
| 57 |
|
|
@@ -104,9 +104,9 @@ demo2 = gr.Interface(
|
|
| 104 |
fn=show_incorrect,
|
| 105 |
inputs=[
|
| 106 |
gr.Number(value=10, minimum=1, maximum=50, label="No. of Misclassified Images", precision=0,
|
| 107 |
-
info="How many misclassified examples do you want to view? (
|
| 108 |
],
|
| 109 |
-
outputs=[gr.Gallery(label="Missclassified Images (
|
| 110 |
)
|
| 111 |
|
| 112 |
demo = gr.TabbedInterface([demo1, demo2], ["Classifier", "Misclassified Images"])
|
|
|
|
| 50 |
|
| 51 |
|
| 52 |
def image_classifier(input_image, top_classes=3, show_cam=True, target_layers=[2, 3], transparency=0.5):
|
| 53 |
+
input_image = transform(image=input_image).unsqueeze(0)
|
| 54 |
+
#aug(image=image)
|
| 55 |
output = model(input_image)
|
| 56 |
output = F.softmax(output.flatten(), dim=-1)
|
| 57 |
|
|
|
|
| 104 |
fn=show_incorrect,
|
| 105 |
inputs=[
|
| 106 |
gr.Number(value=10, minimum=1, maximum=50, label="No. of Misclassified Images", precision=0,
|
| 107 |
+
info="How many misclassified examples do you want to view? (max 50)")
|
| 108 |
],
|
| 109 |
+
outputs=[gr.Gallery(label="Missclassified Images (Actual / Predicted)", columns=5)]
|
| 110 |
)
|
| 111 |
|
| 112 |
demo = gr.TabbedInterface([demo1, demo2], ["Classifier", "Misclassified Images"])
|