Spaces:
Running
on
Zero
Running
on
Zero
Update app.py
Browse files
app.py
CHANGED
@@ -30,7 +30,7 @@ def load_example_image_groups(directory):
|
|
30 |
if os.path.isdir(subdir_path):
|
31 |
example_groups[subdir] = []
|
32 |
images = [f for f in os.listdir(subdir_path) if f.lower().endswith(('.png', '.jpg', '.jpeg'))]
|
33 |
-
images
|
34 |
for filename in images:
|
35 |
img = Image.open(os.path.join(subdir_path, filename))
|
36 |
example_groups[subdir].append(img)
|
@@ -58,14 +58,10 @@ def main(_):
|
|
58 |
|
59 |
generated_images = []
|
60 |
for candidate in output_images:
|
61 |
-
|
62 |
-
for i in range(len(candidate)):
|
63 |
-
concatenated_row = np.concatenate([input_images[i]] + candidate, axis=1)
|
64 |
-
concatenated_rows.append(concatenated_row)
|
65 |
-
combined_image = np.concatenate(concatenated_rows, axis=0)
|
66 |
generated_images.append(
|
67 |
Image.fromarray(
|
68 |
-
(
|
69 |
)
|
70 |
)
|
71 |
|
@@ -146,7 +142,7 @@ def main(_):
|
|
146 |
)
|
147 |
gr.Markdown('## Outputs (multi candidates)')
|
148 |
output_gallery = gr.Gallery(
|
149 |
-
columns=
|
150 |
object_fit='scale-down',
|
151 |
label="Output image"
|
152 |
)
|
|
|
30 |
if os.path.isdir(subdir_path):
|
31 |
example_groups[subdir] = []
|
32 |
images = [f for f in os.listdir(subdir_path) if f.lower().endswith(('.png', '.jpg', '.jpeg'))]
|
33 |
+
images are natsorted(images, key=natural_sort_key)
|
34 |
for filename in images:
|
35 |
img = Image.open(os.path.join(subdir_path, filename))
|
36 |
example_groups[subdir].append(img)
|
|
|
58 |
|
59 |
generated_images = []
|
60 |
for candidate in output_images:
|
61 |
+
combined_row = np.concatenate([input_images[0]] + list(candidate), axis=1)
|
|
|
|
|
|
|
|
|
62 |
generated_images.append(
|
63 |
Image.fromarray(
|
64 |
+
(combined_row * 255).astype(np.uint8)
|
65 |
)
|
66 |
)
|
67 |
|
|
|
142 |
)
|
143 |
gr.Markdown('## Outputs (multi candidates)')
|
144 |
output_gallery = gr.Gallery(
|
145 |
+
columns=1,
|
146 |
object_fit='scale-down',
|
147 |
label="Output image"
|
148 |
)
|