Nunzio commited on
Commit
c1b49d2
·
1 Parent(s): 792a3b8
Files changed (1) hide show
  1. app.py +8 -9
app.py CHANGED
@@ -80,20 +80,19 @@ with gr.Blocks(title="Semantic Segmentation Predictors") as demo:
80
  result_display = gr.Image(label="Model prediction", visible=True)
81
  error_text = gr.Markdown("", visible=False)
82
 
83
- def updateImage(image: gr.Image):
84
- image_input.value = image
85
-
86
  with gr.Row():
87
  gr.Markdown("## Preloaded images to be used for testing the model")
88
  gr.Markdown("You can use images from the Grand Theft Auto V video game, the Cityscapes dataset or even from Turin")
 
 
 
 
89
  for i in range(0, len(image_list), 5):
90
  with gr.Row():
91
- for img, path in image_list[i:i+5]:
92
- with gr.Column(scale=1):
93
- btn = gr.Button(value=gr.Image(value=img, show_label=False, show_download_button=False, height=150),
94
- visible=True, interactive=True, min_width=150)
95
- btn.click(fn=updateImage, inputs=btn.value, outputs=image_input)
96
-
97
  submit_btn.click(
98
  fn=run_prediction,
99
  inputs=[image_input, model_selector],
 
80
  result_display = gr.Image(label="Model prediction", visible=True)
81
  error_text = gr.Markdown("", visible=False)
82
 
 
 
 
83
  with gr.Row():
84
  gr.Markdown("## Preloaded images to be used for testing the model")
85
  gr.Markdown("You can use images from the Grand Theft Auto V video game, the Cityscapes dataset or even from Turin")
86
+ def set_image(image):
87
+ return image
88
+
89
+ # Mostriamo 4 righe da 5 immagini
90
  for i in range(0, len(image_list), 5):
91
  with gr.Row():
92
+ for img, _ in image_list[i:i+5]:
93
+ img_comp = gr.Image(value=img, interactive=True, show_label=False, show_download_button=False, height=140)
94
+ img_comp.select(fn=set_image, inputs=img_comp, outputs=image_input)
95
+
 
 
96
  submit_btn.click(
97
  fn=run_prediction,
98
  inputs=[image_input, model_selector],