fixed DEFAULT_LAYER value in app.py
Browse files
app.py
CHANGED
@@ -115,7 +115,8 @@ def plot_weights(input_data, patch_weights, num_attention_block):
|
|
115 |
attn_map_img = attn_map_img.resize((224, 224), Image.ANTIALIAS)
|
116 |
attn_map_img.save(f"storage/attention_map_{num_attention_block}.png", "PNG")
|
117 |
|
118 |
-
|
|
|
119 |
|
120 |
title_classify = "Image Based Plant Disease Identification ππ€"
|
121 |
|
@@ -146,7 +147,7 @@ attention_interface = gr.Interface(
|
|
146 |
fn=plot_attention,
|
147 |
inputs=[gr.Image(type="pil", label="Image"),
|
148 |
gr.Dropdown(choices=["1", "2", "3", "4", "5", "6", "7", "8", "9", "10", "11", "12"],
|
149 |
-
value=
|
150 |
outputs=gr.Gallery(value=attention_maps, label="Attention Maps").style(grid=(3, 4)),
|
151 |
examples=example_list,
|
152 |
title=title_attention,
|
|
|
115 |
attn_map_img = attn_map_img.resize((224, 224), Image.ANTIALIAS)
|
116 |
attn_map_img.save(f"storage/attention_map_{num_attention_block}.png", "PNG")
|
117 |
|
118 |
+
DEFAULT_LAYER = "6"
|
119 |
+
attention_maps = plot_attention(random_image, DEFAULT_LAYER)
|
120 |
|
121 |
title_classify = "Image Based Plant Disease Identification ππ€"
|
122 |
|
|
|
147 |
fn=plot_attention,
|
148 |
inputs=[gr.Image(type="pil", label="Image"),
|
149 |
gr.Dropdown(choices=["1", "2", "3", "4", "5", "6", "7", "8", "9", "10", "11", "12"],
|
150 |
+
value=DEFAULT_LAYER, label="Attention Layer")],
|
151 |
outputs=gr.Gallery(value=attention_maps, label="Attention Maps").style(grid=(3, 4)),
|
152 |
examples=example_list,
|
153 |
title=title_attention,
|