Dan Bochman commited on
Commit
58104b5
·
1 Parent(s): b93893e

feat: enhance UI with image dimensions and accordion legend

Browse files

- Added height and width attributes to image components for better layout control.
- Moved the legend image into an accordion section for improved organization and visibility.

Files changed (2) hide show
  1. .gitignore +1 -0
  2. app.py +15 -9
.gitignore CHANGED
@@ -2,3 +2,4 @@ __pycache__/
2
  *.pyc
3
  .DS_Store
4
  assets/legend.png
 
 
2
  *.pyc
3
  .DS_Store
4
  assets/legend.png
5
+ .venv/
app.py CHANGED
@@ -274,6 +274,8 @@ with gr.Blocks() as demo:
274
  type="pil",
275
  sources=["upload", "clipboard"],
276
  elem_classes=["contain"],
 
 
277
  )
278
  run_button = gr.Button("Run", variant="primary", size="lg")
279
 
@@ -285,6 +287,15 @@ with gr.Blocks() as demo:
285
  label="Examples",
286
  )
287
 
 
 
 
 
 
 
 
 
 
288
  # Right column: Results
289
  with gr.Column(scale=1):
290
  result_image = gr.Image(
@@ -292,23 +303,18 @@ with gr.Blocks() as demo:
292
  type="pil",
293
  interactive=False,
294
  elem_classes=["contain"],
 
 
295
  )
296
  mask_image = gr.Image(
297
  label="Segmentation Mask",
298
  type="pil",
299
  interactive=False,
300
  elem_classes=["contain"],
 
 
301
  )
302
 
303
- # Legend in accordion
304
- with gr.Accordion("Label Legend", open=True):
305
- gr.Image(
306
- value=legend_path,
307
- label=None,
308
- show_label=False,
309
- interactive=False,
310
- )
311
-
312
  # Event handler
313
  run_button.click(
314
  fn=segment,
 
274
  type="pil",
275
  sources=["upload", "clipboard"],
276
  elem_classes=["contain"],
277
+ height=576,
278
+ width=384,
279
  )
280
  run_button = gr.Button("Run", variant="primary", size="lg")
281
 
 
287
  label="Examples",
288
  )
289
 
290
+ # Legend below examples
291
+ with gr.Accordion("Label Legend", open=True):
292
+ gr.Image(
293
+ value=legend_path,
294
+ label=None,
295
+ show_label=False,
296
+ interactive=False,
297
+ )
298
+
299
  # Right column: Results
300
  with gr.Column(scale=1):
301
  result_image = gr.Image(
 
303
  type="pil",
304
  interactive=False,
305
  elem_classes=["contain"],
306
+ height=576,
307
+ width=384,
308
  )
309
  mask_image = gr.Image(
310
  label="Segmentation Mask",
311
  type="pil",
312
  interactive=False,
313
  elem_classes=["contain"],
314
+ height=576,
315
+ width=384,
316
  )
317
 
 
 
 
 
 
 
 
 
 
318
  # Event handler
319
  run_button.click(
320
  fn=segment,