Spaces:
Sleeping
Sleeping
gradio interface to gr.blocks
Browse files
app.py
CHANGED
@@ -103,18 +103,25 @@ def sepia(input_img):
|
|
103 |
fig = draw_plot(pred_img, seg)
|
104 |
return fig
|
105 |
|
106 |
-
|
107 |
-
|
108 |
-
|
109 |
-
|
110 |
-
|
111 |
-
|
112 |
-
|
113 |
-
|
114 |
-
|
115 |
-
|
116 |
-
|
117 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
118 |
|
119 |
|
120 |
demo.launch()
|
|
|
103 |
fig = draw_plot(pred_img, seg)
|
104 |
return fig
|
105 |
|
106 |
+
|
107 |
+
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 |
|
127 |
demo.launch()
|