Spaces:
Sleeping
Sleeping
Nunzio commited on
Commit ·
792a3b8
1
Parent(s): d7e37f8
bho
Browse files
app.py
CHANGED
|
@@ -80,6 +80,9 @@ 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 |
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")
|
|
@@ -87,15 +90,9 @@ with gr.Blocks(title="Semantic Segmentation Predictors") as demo:
|
|
| 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 |
-
|
| 92 |
-
btn.
|
| 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,
|
|
|
|
| 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")
|
|
|
|
| 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,
|