Upload app.py
Browse files
app.py
CHANGED
|
@@ -123,35 +123,35 @@ with gr.Blocks(title="Cityscapes Segmentation") as demo:
|
|
| 123 |
"**Backbone LR:** 6e-5 · **Loss:** 0.7 CE + 0.3 Dice"
|
| 124 |
)
|
| 125 |
|
| 126 |
-
with gr.Tab("Try it yourself"):
|
| 127 |
-
|
| 128 |
-
|
| 129 |
-
|
| 130 |
-
|
| 131 |
-
|
| 132 |
-
|
| 133 |
-
|
| 134 |
-
|
| 135 |
-
|
| 136 |
-
|
| 137 |
-
|
| 138 |
-
|
| 139 |
-
|
| 140 |
-
|
| 141 |
-
|
| 142 |
-
|
| 143 |
-
|
| 144 |
-
|
| 145 |
-
|
| 146 |
-
|
| 147 |
-
|
| 148 |
-
|
| 149 |
-
|
| 150 |
-
|
| 151 |
-
|
| 152 |
-
|
| 153 |
-
|
| 154 |
-
|
| 155 |
|
| 156 |
# ── Tab 2: Dataset results gallery ────────────────────────────
|
| 157 |
with gr.Tab("Dataset results"):
|
|
|
|
| 123 |
"**Backbone LR:** 6e-5 · **Loss:** 0.7 CE + 0.3 Dice"
|
| 124 |
)
|
| 125 |
|
| 126 |
+
with gr.Tab("Try it yourself"):
|
| 127 |
+
|
| 128 |
+
# ── Row 1: Upload left, Output right ───────────────────────
|
| 129 |
+
with gr.Row():
|
| 130 |
+
with gr.Column(scale=1):
|
| 131 |
+
input_img = gr.Image(type="pil", label="Upload a street image")
|
| 132 |
+
run_btn = gr.Button("Run segmentation ▶", variant="primary")
|
| 133 |
+
|
| 134 |
+
with gr.Column(scale=1):
|
| 135 |
+
out_mask = gr.Image(label="Prediction mask",
|
| 136 |
+
interactive=False,
|
| 137 |
+
height=512)
|
| 138 |
+
|
| 139 |
+
# ── Row 2: Examples under the button ───────────────────────
|
| 140 |
+
with gr.Row():
|
| 141 |
+
gr.Examples(
|
| 142 |
+
examples=EXAMPLES,
|
| 143 |
+
inputs=input_img,
|
| 144 |
+
outputs=[out_mask],
|
| 145 |
+
fn=run_inference,
|
| 146 |
+
cache_examples=False,
|
| 147 |
+
)
|
| 148 |
+
|
| 149 |
+
gr.Image(value=legend_img, label="Colour legend — 19 Cityscapes classes",
|
| 150 |
+
interactive=False)
|
| 151 |
+
|
| 152 |
+
run_btn.click(fn=run_inference,
|
| 153 |
+
inputs=input_img,
|
| 154 |
+
outputs=[out_mask])
|
| 155 |
|
| 156 |
# ── Tab 2: Dataset results gallery ────────────────────────────
|
| 157 |
with gr.Tab("Dataset results"):
|