Update app.py
Browse files
app.py
CHANGED
|
@@ -251,24 +251,37 @@ with gr.Blocks(title=title) as demo:
|
|
| 251 |
outputs=[pred_out, pb_out, pv_out, masked_img_out, overlay_out]
|
| 252 |
)
|
| 253 |
|
| 254 |
-
gr.Markdown("## Test Samples")
|
| 255 |
-
|
| 256 |
-
with gr.Row(scale=1):
|
| 257 |
|
| 258 |
-
|
| 259 |
-
|
| 260 |
-
|
| 261 |
-
|
|
|
|
|
|
|
|
|
|
| 262 |
|
| 263 |
-
|
| 264 |
-
with gr.Column(scale=1):
|
| 265 |
-
gr.Markdown("### VIRAL")
|
| 266 |
-
gr.Image("images/VIRAL.jpeg", show_label=False, height=220)
|
| 267 |
|
| 268 |
-
|
| 269 |
-
|
| 270 |
-
gr.
|
| 271 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 272 |
|
| 273 |
if __name__ == "__main__":
|
| 274 |
demo.launch()
|
|
|
|
| 251 |
outputs=[pred_out, pb_out, pv_out, masked_img_out, overlay_out]
|
| 252 |
)
|
| 253 |
|
|
|
|
|
|
|
|
|
|
| 254 |
|
| 255 |
+
test_samples = [
|
| 256 |
+
("images/NORMAL.jpeg", "NORMAL"),
|
| 257 |
+
("images/VIRAL.jpeg", "VIRAL"),
|
| 258 |
+
("images/BACT.jpeg", "BACTERIAL"),
|
| 259 |
+
]
|
| 260 |
+
|
| 261 |
+
gr.Markdown("## Test Samples")
|
| 262 |
|
| 263 |
+
sample_buttons = []
|
|
|
|
|
|
|
|
|
|
| 264 |
|
| 265 |
+
with gr.Row():
|
| 266 |
+
for img_path, label in test_samples:
|
| 267 |
+
with gr.Column(scale=1):
|
| 268 |
+
gr.Markdown(f"### {label}")
|
| 269 |
+
btn = gr.Image(
|
| 270 |
+
img_path,
|
| 271 |
+
show_label=False,
|
| 272 |
+
height=220,
|
| 273 |
+
interactive=True
|
| 274 |
+
)
|
| 275 |
+
sample_buttons.append(btn)
|
| 276 |
+
|
| 277 |
+
# Auto-run inference when any sample is clicked
|
| 278 |
+
for btn in sample_buttons:
|
| 279 |
+
btn.change(
|
| 280 |
+
inference_pipeline,
|
| 281 |
+
inputs=[btn, thresh_b, thresh_v, seg_thresh],
|
| 282 |
+
outputs=[pred_out, pb_out, pv_out, masked_img_out, overlay_out]
|
| 283 |
+
)
|
| 284 |
+
|
| 285 |
|
| 286 |
if __name__ == "__main__":
|
| 287 |
demo.launch()
|