Nunzio commited on
Commit
d7e37f8
·
1 Parent(s): 4d2f437

added buttons

Browse files
Files changed (1) hide show
  1. app.py +13 -10
app.py CHANGED
@@ -83,16 +83,19 @@ with gr.Blocks(title="Semantic Segmentation Predictors") as demo:
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
- with gr.Row():
87
- def create_image_selector(image):
88
- def select_image():
89
- image_input.value = image
90
- return gr.update(value=image, visible=True)
91
- return select_image
92
-
93
- for img, path in image_list:
94
- img_component = gr.Image(value=img, interactive=True, show_label=False)
95
- img_component.select(fn=create_image_selector, inputs=[], outputs=image_input)
 
 
 
96
 
97
  submit_btn.click(
98
  fn=run_prediction,
 
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
+ for i in range(0, len(image_list), 5):
87
+ with gr.Row():
88
+ for img, path in image_list[i:i+5]:
89
+ with gr.Column(scale=1):
90
+ gr.Image(value=img, show_label=False, show_download_button=False, height=150)
91
+ btn = gr.Button(" ", visible=True)
92
+ btn.style(height=150, width=150, border_radius="10px", background_color="#f0f0f0", font_size="1px")
93
+ def make_on_click(image):
94
+ def on_click():
95
+ return image
96
+ return on_click
97
+
98
+ btn.click(fn=make_on_click(img), outputs=image_input)
99
 
100
  submit_btn.click(
101
  fn=run_prediction,