Commit ·
4d18b32
1
Parent(s): abbdf7a
Add Refresh button to Gallery tab to manually reload thumbnails
Browse files- ui/layout.py +4 -0
ui/layout.py
CHANGED
|
@@ -43,8 +43,12 @@ 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", type="filepath")
|
| 47 |
ui_components["gallery"] = gallery
|
|
|
|
|
|
|
| 48 |
|
| 49 |
ui_components["tabs"] = tabs
|
| 50 |
ui_components["image_gen_tabs"] = tabs
|
|
|
|
| 43 |
|
| 44 |
# New Gallery tab to display generated images
|
| 45 |
with gr.TabItem("Gallery", id=5):
|
| 46 |
+
# Refresh button to manually reload thumbnails from the output folder.
|
| 47 |
+
refresh_btn = gr.Button("Refresh Gallery", variant="secondary")
|
| 48 |
gallery = gr.Gallery(label="Generated Images", show_label=False, columns=3, height="auto", type="filepath")
|
| 49 |
ui_components["gallery"] = gallery
|
| 50 |
+
# Bind the refresh button to the same loader used on startup.
|
| 51 |
+
refresh_btn.click(fn=load_gallery_images, outputs=gallery)
|
| 52 |
|
| 53 |
ui_components["tabs"] = tabs
|
| 54 |
ui_components["image_gen_tabs"] = tabs
|