tu11p commited on
Commit
f65e7b6
1 Parent(s): 2c8378d

Fix gr.Blocks

Browse files
Files changed (1) hide show
  1. app.py +11 -11
app.py CHANGED
@@ -108,19 +108,19 @@ with gr.Blocks(theme=gr.themes.Monochrome()) as demo:
108
  with gr.Tab("Semantic Segmentation with Cityscape Image"):
109
  with gr.Row():
110
  with gr.Column(scale=1):
111
- input_image = gr.Image(label="Upload Image")
 
 
 
 
 
 
112
  process_button = gr.Button("Process Image")
113
  with gr.Column(scale=2):
114
- output_plot = gr.Plot(label="Segmented Image")
115
- examples_gallery = gr.Gallery(
116
- ["city_1.jpg", "city_2.jpg", "city_3.jpg",
117
- "city_4.jpg", "city_5.jpg", "city_6.jpg",
118
- "city_7.jpg", "city_8.jpg"]
119
- ).style(grid=3)
120
- examples_gallery.click(sepia, inputs=input_image, outputs=output_plot)
121
- process_button.click(sepia, inputs=input_image, outputs=output_plot)
122
-
123
- with gr.Accordion("Details and Information"):
124
  gr.Markdown("A Gradio-based page which performs Semantic Segmentation into 19 classes for an example image")
125
 
126
 
 
108
  with gr.Tab("Semantic Segmentation with Cityscape Image"):
109
  with gr.Row():
110
  with gr.Column(scale=1):
111
+ input_gallery = gr.Gallery(label="Select an Image",
112
+ value="city_1.jpg",
113
+ items=["city_1.jpg", "city_2.jpg", "city_3.jpg",
114
+ "city_4.jpg", "city_5.jpg", "city_6.jpg",
115
+ "city_7.jpg", "city_8.jpg"]).style(grid=3)
116
+ input_image = gr.Image(label="Uploaded Image", interactive=True, type="pil")
117
+ input_gallery.change(fn=lambda x: x, inputs=input_gallery, outputs=input_image)
118
  process_button = gr.Button("Process Image")
119
  with gr.Column(scale=2):
120
+ output_image = gr.Plot(label="Segmented Image")
121
+ process_button.click(sepia, inputs=input_image, outputs=output_image)
122
+
123
+ with gr.Accordion("Information"):
 
 
 
 
 
 
124
  gr.Markdown("A Gradio-based page which performs Semantic Segmentation into 19 classes for an example image")
125
 
126