Hermes Bot commited on
Commit ·
a69ebc6
1
Parent(s): b9d8f1a
Show generation info only in global Gallery tab and remove per-tab metadata boxes
Browse files- ui/events/run_handlers.py +6 -4
- ui/layout.py +3 -0
ui/events/run_handlers.py
CHANGED
|
@@ -106,9 +106,9 @@ def create_run_event(prefix: str, task_type: str, ui_components: dict):
|
|
| 106 |
run_btn.click(
|
| 107 |
fn=_run_with_meta,
|
| 108 |
inputs=input_list_flat,
|
| 109 |
-
outputs=[res_gal
|
| 110 |
)
|
| 111 |
-
# When a user selects an image from the
|
| 112 |
def _show_meta(selected_path, *_):
|
| 113 |
try:
|
| 114 |
from PIL import Image
|
|
@@ -117,5 +117,7 @@ def create_run_event(prefix: str, task_type: str, ui_components: dict):
|
|
| 117 |
except Exception:
|
| 118 |
meta = ''
|
| 119 |
return meta
|
| 120 |
-
# Connect the select event of the gallery to update
|
| 121 |
-
|
|
|
|
|
|
|
|
|
| 106 |
run_btn.click(
|
| 107 |
fn=_run_with_meta,
|
| 108 |
inputs=input_list_flat,
|
| 109 |
+
outputs=[res_gal]
|
| 110 |
)
|
| 111 |
+
# When a user selects an image from the global Gallery tab, load its generation info
|
| 112 |
def _show_meta(selected_path, *_):
|
| 113 |
try:
|
| 114 |
from PIL import Image
|
|
|
|
| 117 |
except Exception:
|
| 118 |
meta = ''
|
| 119 |
return meta
|
| 120 |
+
# Connect the select event of the global gallery to update its metadata textbox
|
| 121 |
+
gallery_tab = ui_components.get('gallery')
|
| 122 |
+
if gallery_tab:
|
| 123 |
+
gallery_tab.select(fn=_show_meta, inputs=gallery_tab, outputs=ui_components.get('gallery_metadata'))
|
ui/layout.py
CHANGED
|
@@ -102,6 +102,9 @@ def build_ui(event_handler_function):
|
|
| 102 |
# Main gallery component.
|
| 103 |
gallery = gr.Gallery(label="Generated Images", show_label=False, columns=4, height="auto", type="filepath")
|
| 104 |
ui_components["gallery"] = gallery
|
|
|
|
|
|
|
|
|
|
| 105 |
# Hidden file component for zip download.
|
| 106 |
download_file = gr.File(label="Download", visible=False)
|
| 107 |
# Bind buttons.
|
|
|
|
| 102 |
# Main gallery component.
|
| 103 |
gallery = gr.Gallery(label="Generated Images", show_label=False, columns=4, height="auto", type="filepath")
|
| 104 |
ui_components["gallery"] = gallery
|
| 105 |
+
# Textbox to show generation info for selected image.
|
| 106 |
+
metadata_box = gr.Textbox(label="Generation info", lines=4, interactive=False)
|
| 107 |
+
ui_components["gallery_metadata"] = metadata_box
|
| 108 |
# Hidden file component for zip download.
|
| 109 |
download_file = gr.File(label="Download", visible=False)
|
| 110 |
# Bind buttons.
|