huzey commited on
Commit
8d1d2de
1 Parent(s): 59742d8
Files changed (1) hide show
  1. app.py +11 -11
app.py CHANGED
@@ -484,14 +484,13 @@ def make_dataset_images_section(advanced=False):
484
  with gr.Column() as advanced_block:
485
  dataset_names = DATASET_NAMES
486
  dataset_classes = DATASET_CLASSES
487
- dataset_dropdown = gr.Dropdown(dataset_names, label="Dataset name", value="mrm8488/ImageNet1K-val", elem_id="dataset")
488
- num_images_slider = gr.Number(10, label="Number of images", elem_id="num_images")
489
- # with gr.Row():
490
- filter_by_class_checkbox = gr.Checkbox(label="Filter by class", value=True, elem_id="filter_by_class_checkbox")
491
- filter_by_class_text = gr.Textbox(label="Class to select", value="0,33,99", elem_id="filter_by_class_text", info=f"e.g. `0,1,2`. (1000 classes)", visible=True)
492
- # with gr.Row():
493
- is_random_checkbox = gr.Checkbox(label="Random shuffle", value=False, elem_id="random_seed_checkbox")
494
- random_seed_slider = gr.Slider(0, 1000, step=1, label="Random seed", value=1, elem_id="random_seed", visible=False)
495
 
496
  if advanced:
497
  advanced_block.visible = True
@@ -519,7 +518,7 @@ def make_dataset_images_section(advanced=False):
519
  idx = dataset_names.index(dataset_name)
520
  num_classes = dataset_classes[idx]
521
  return gr.Textbox(label="Class to select", value="0,1,2", elem_id="filter_by_class_text", info=f"e.g. `0,1,2`. ({num_classes} classes)", visible=is_filter)
522
- filter_by_class_checkbox.change(fn=change_filter_by_class, inputs=[filter_by_class_checkbox, dataset_dropdown], outputs=filter_by_class_text)
523
 
524
  def change_random_seed(is_random):
525
  return gr.Slider(0, 1000, step=1, label="Random seed", value=1, elem_id="random_seed", visible=is_random)
@@ -727,8 +726,9 @@ with demo:
727
  with gr.Row():
728
  with gr.Column(scale=5, min_width=200):
729
  input_gallery, submit_button, clear_images_button = make_input_images_section()
730
- dataset_dropdown, num_images_slider, random_seed_slider, load_images_button = make_dataset_images_section()
731
  num_images_slider.value = 100
 
732
 
733
  with gr.Column(scale=5, min_width=200):
734
  with gr.Accordion("➡️ Recursion config", open=True):
@@ -769,7 +769,7 @@ with demo:
769
  false_placeholder.visible = False
770
  number_placeholder = gr.Number(0, label="Number placeholder", elem_id="number_placeholder")
771
  number_placeholder.visible = False
772
- clear_images_button.click(lambda x: ([], [], [], []), outputs=[input_gallery, l1_gallery, l2_gallery, l3_gallery])
773
  submit_button.click(
774
  run_fn,
775
  inputs=[
 
484
  with gr.Column() as advanced_block:
485
  dataset_names = DATASET_NAMES
486
  dataset_classes = DATASET_CLASSES
487
+ with gr.Row():
488
+ dataset_dropdown = gr.Dropdown(dataset_names, label="Dataset name", value="mrm8488/ImageNet1K-val", elem_id="dataset", min_width=300)
489
+ num_images_slider = gr.Number(10, label="Number of images", elem_id="num_images")
490
+ filter_by_class_checkbox = gr.Checkbox(label="Filter by class", value=True, elem_id="filter_by_class_checkbox")
491
+ filter_by_class_text = gr.Textbox(label="Class to select", value="0,33,99", elem_id="filter_by_class_text", info=f"e.g. `0,1,2`. (1000 classes)", visible=True)
492
+ is_random_checkbox = gr.Checkbox(label="Random shuffle", value=False, elem_id="random_seed_checkbox")
493
+ random_seed_slider = gr.Slider(0, 1000, step=1, label="Random seed", value=1, elem_id="random_seed", visible=False)
 
494
 
495
  if advanced:
496
  advanced_block.visible = True
 
518
  idx = dataset_names.index(dataset_name)
519
  num_classes = dataset_classes[idx]
520
  return gr.Textbox(label="Class to select", value="0,1,2", elem_id="filter_by_class_text", info=f"e.g. `0,1,2`. ({num_classes} classes)", visible=is_filter)
521
+ # filter_by_class_checkbox.change(fn=change_filter_by_class, inputs=[filter_by_class_checkbox, dataset_dropdown], outputs=filter_by_class_text)
522
 
523
  def change_random_seed(is_random):
524
  return gr.Slider(0, 1000, step=1, label="Random seed", value=1, elem_id="random_seed", visible=is_random)
 
726
  with gr.Row():
727
  with gr.Column(scale=5, min_width=200):
728
  input_gallery, submit_button, clear_images_button = make_input_images_section()
729
+ dataset_dropdown, num_images_slider, random_seed_slider, load_images_button = make_dataset_images_section(advanced=True)
730
  num_images_slider.value = 100
731
+ clear_images_button.visible = False
732
 
733
  with gr.Column(scale=5, min_width=200):
734
  with gr.Accordion("➡️ Recursion config", open=True):
 
769
  false_placeholder.visible = False
770
  number_placeholder = gr.Number(0, label="Number placeholder", elem_id="number_placeholder")
771
  number_placeholder.visible = False
772
+ clear_images_button.click(lambda x: ([],), outputs=[input_gallery])
773
  submit_button.click(
774
  run_fn,
775
  inputs=[