Spaces:
Running
on
Zero
Running
on
Zero
update UI
Browse files
app.py
CHANGED
|
@@ -136,12 +136,10 @@ def get_random_path(length=10):
|
|
| 136 |
return path
|
| 137 |
|
| 138 |
default_images = ['./images/image_0.jpg', './images/image_1.jpg', './images/image_2.jpg', './images/image_3.jpg', './images/image_5.jpg']
|
| 139 |
-
# default_outputs = ['./images/ncut_0.jpg', './images/ncut_1.jpg', './images/ncut_2.jpg', './images/ncut_3.jpg', './images/ncut_5.jpg']
|
| 140 |
default_outputs = ['./images/image-1.webp', './images/image-2.webp', './images/image-3.webp', './images/image-4.webp', './images/image-5.webp']
|
| 141 |
-
default_outputs_independent = ['./images/
|
| 142 |
|
| 143 |
downscaled_images = ['./images/image_0_small.jpg', './images/image_1_small.jpg', './images/image_2_small.jpg', './images/image_3_small.jpg', './images/image_5_small.jpg']
|
| 144 |
-
# downscaled_outputs = ['./images/ncut_0_small.jpg', './images/ncut_1_small.jpg', './images/ncut_2_small.jpg', './images/ncut_3_small.jpg', './images/ncut_5_small.jpg']
|
| 145 |
downscaled_outputs = default_outputs
|
| 146 |
|
| 147 |
example_items = downscaled_images[:3] + downscaled_outputs[:3]
|
|
@@ -433,8 +431,8 @@ def make_example_video_section():
|
|
| 433 |
load_video_button = gr.Button("Load Example", elem_id="load-video-button")
|
| 434 |
return load_video_button
|
| 435 |
|
| 436 |
-
def make_dataset_images_section():
|
| 437 |
-
with gr.Accordion("➡️ Click to expand: Load from dataset", open=
|
| 438 |
dataset_names = [
|
| 439 |
'UCSC-VLAA/Recap-COCO-30K',
|
| 440 |
'nateraw/pascal-voc-2012',
|
|
@@ -469,7 +467,7 @@ def make_dataset_images_section():
|
|
| 469 |
|
| 470 |
def make_output_images_section():
|
| 471 |
gr.Markdown('### Output Images')
|
| 472 |
-
output_gallery = gr.Gallery(value=[], label="NCUT Embedding", show_label=False, elem_id="ncut", columns=[3], rows=[1], object_fit="contain", height="auto"
|
| 473 |
return output_gallery
|
| 474 |
|
| 475 |
def make_parameters_section():
|
|
@@ -735,7 +733,7 @@ with gr.Blocks() as demo:
|
|
| 735 |
load_images_button, example_gallery, hide_button = make_example_images_section()
|
| 736 |
example_gallery.visible = False
|
| 737 |
hide_button.visible = False
|
| 738 |
-
dataset_dropdown, num_images_slider, random_seed_slider, load_dataset_button = make_dataset_images_section()
|
| 739 |
load_images_button.click(lambda x: default_images, outputs=input_gallery)
|
| 740 |
|
| 741 |
with gr.Column(scale=5, min_width=200):
|
|
|
|
| 136 |
return path
|
| 137 |
|
| 138 |
default_images = ['./images/image_0.jpg', './images/image_1.jpg', './images/image_2.jpg', './images/image_3.jpg', './images/image_5.jpg']
|
|
|
|
| 139 |
default_outputs = ['./images/image-1.webp', './images/image-2.webp', './images/image-3.webp', './images/image-4.webp', './images/image-5.webp']
|
| 140 |
+
default_outputs_independent = ['./images/image-6.webp', './images/image-7.webp', './images/image-8.webp', './images/image-9.webp', './images/image-10.webp']
|
| 141 |
|
| 142 |
downscaled_images = ['./images/image_0_small.jpg', './images/image_1_small.jpg', './images/image_2_small.jpg', './images/image_3_small.jpg', './images/image_5_small.jpg']
|
|
|
|
| 143 |
downscaled_outputs = default_outputs
|
| 144 |
|
| 145 |
example_items = downscaled_images[:3] + downscaled_outputs[:3]
|
|
|
|
| 431 |
load_video_button = gr.Button("Load Example", elem_id="load-video-button")
|
| 432 |
return load_video_button
|
| 433 |
|
| 434 |
+
def make_dataset_images_section(open=False):
|
| 435 |
+
with gr.Accordion("➡️ Click to expand: Load from dataset", open=open):
|
| 436 |
dataset_names = [
|
| 437 |
'UCSC-VLAA/Recap-COCO-30K',
|
| 438 |
'nateraw/pascal-voc-2012',
|
|
|
|
| 467 |
|
| 468 |
def make_output_images_section():
|
| 469 |
gr.Markdown('### Output Images')
|
| 470 |
+
output_gallery = gr.Gallery(value=[], label="NCUT Embedding", show_label=False, elem_id="ncut", columns=[3], rows=[1], object_fit="contain", height="auto", show_download_button=True
|
| 471 |
return output_gallery
|
| 472 |
|
| 473 |
def make_parameters_section():
|
|
|
|
| 733 |
load_images_button, example_gallery, hide_button = make_example_images_section()
|
| 734 |
example_gallery.visible = False
|
| 735 |
hide_button.visible = False
|
| 736 |
+
dataset_dropdown, num_images_slider, random_seed_slider, load_dataset_button = make_dataset_images_section(open=True)
|
| 737 |
load_images_button.click(lambda x: default_images, outputs=input_gallery)
|
| 738 |
|
| 739 |
with gr.Column(scale=5, min_width=200):
|