assistanttttttt commited on
Commit
bdda5f1
·
1 Parent(s): 2c31db4

Separate Gallery tab to show thumbnails from output folder only, not duplicate result images

Browse files
Files changed (2) hide show
  1. ui/events/run_handlers.py +5 -2
  2. ui/layout.py +1 -1
ui/events/run_handlers.py CHANGED
@@ -98,8 +98,11 @@ def create_run_event(prefix: str, task_type: str, ui_components: dict):
98
  if run_btn and res_gal:
99
  outputs = [res_gal]
100
  gallery_tab = ui_components.get('gallery')
101
- if gallery_tab:
102
- outputs.append(gallery_tab)
 
 
 
103
  run_btn.click(
104
  fn=lambda *args, progress=gr.Progress(track_tqdm=True): (
105
  lambda res: [res, res] if ui_components.get('gallery') else res
 
98
  if run_btn and res_gal:
99
  outputs = [res_gal]
100
  gallery_tab = ui_components.get('gallery')
101
+ # The global Gallery tab shows images from the output folder independently.
102
+ # Therefore we do NOT duplicate the result here.
103
+ # The Gallery component loads images via demo.load() on startup.
104
+ # No need to add it to the run button outputs.
105
+
106
  run_btn.click(
107
  fn=lambda *args, progress=gr.Progress(track_tqdm=True): (
108
  lambda res: [res, res] if ui_components.get('gallery') else res
ui/layout.py CHANGED
@@ -43,7 +43,7 @@ def build_ui(event_handler_function):
43
 
44
  # New Gallery tab to display generated images
45
  with gr.TabItem("Gallery", id=5):
46
- gallery = gr.Gallery(label="Generated Images", show_label=False, columns=3, height="auto")
47
  ui_components["gallery"] = gallery
48
 
49
  ui_components["tabs"] = tabs
 
43
 
44
  # New Gallery tab to display generated images
45
  with gr.TabItem("Gallery", id=5):
46
+ gallery = gr.Gallery(label="Generated Images", show_label=False, columns=3, height="auto", type="filepath")
47
  ui_components["gallery"] = gallery
48
 
49
  ui_components["tabs"] = tabs