Hermes Bot commited on
Commit ·
a79dfdb
1
Parent(s): 478118a
Flatten selected_path recursively to get image path and improve debug
Browse files
ui/events/run_handlers.py
CHANGED
|
@@ -118,9 +118,11 @@ def create_run_event(prefix: str, task_type: str, ui_components: dict):
|
|
| 118 |
def _show_meta(selected_path, *_):
|
| 119 |
# `selected_path` may be a string (filepath) or a list/tuple of filepaths.
|
| 120 |
try:
|
| 121 |
-
#
|
| 122 |
-
path = selected_path
|
| 123 |
-
|
|
|
|
|
|
|
| 124 |
from PIL import Image
|
| 125 |
with Image.open(path) as im:
|
| 126 |
meta = im.info.get("parameters", "")
|
|
|
|
| 118 |
def _show_meta(selected_path, *_):
|
| 119 |
# `selected_path` may be a string (filepath) or a list/tuple of filepaths.
|
| 120 |
try:
|
| 121 |
+
# Recursively flatten until we get a string path
|
| 122 |
+
path = selected_path
|
| 123 |
+
while isinstance(path, (list, tuple)) and len(path) > 0:
|
| 124 |
+
path = path[0]
|
| 125 |
+
print(f"[DEBUG] Extracted image path: {path}")
|
| 126 |
from PIL import Image
|
| 127 |
with Image.open(path) as im:
|
| 128 |
meta = im.info.get("parameters", "")
|