Clocksp commited on
Commit
0632a76
·
verified ·
1 Parent(s): ff90fe5

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +28 -15
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
- # NORMAL
259
- with gr.Column(scale=1):
260
- gr.Markdown("### NORMAL")
261
- gr.Image("images/NORMAL.jpeg", show_label=False, height=220)
 
 
 
262
 
263
- # VIRAL
264
- with gr.Column(scale=1):
265
- gr.Markdown("### VIRAL")
266
- gr.Image("images/VIRAL.jpeg", show_label=False, height=220)
267
 
268
- # BACTERIAL
269
- with gr.Column(scale=1):
270
- gr.Markdown("### BACTERIAL")
271
- gr.Image("images/BACT.jpeg", show_label=False, height=220)
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
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()