Spaces:
Running
on
Zero
Running
on
Zero
Update app.py
Browse files
app.py
CHANGED
@@ -47,6 +47,10 @@ def main(_):
|
|
47 |
use_lock=False,
|
48 |
)
|
49 |
|
|
|
|
|
|
|
|
|
50 |
def generate_images(input_images, n_new_frames, n_candidates, temperature=1.0, top_p=0.9):
|
51 |
assert len(input_images) > 0
|
52 |
input_images = [
|
@@ -58,10 +62,14 @@ def main(_):
|
|
58 |
|
59 |
generated_images = []
|
60 |
for candidate in output_images:
|
61 |
-
|
|
|
|
|
|
|
|
|
62 |
generated_images.append(
|
63 |
Image.fromarray(
|
64 |
-
(
|
65 |
)
|
66 |
)
|
67 |
|
@@ -142,7 +150,7 @@ def main(_):
|
|
142 |
)
|
143 |
gr.Markdown('## Outputs (multi candidates)')
|
144 |
output_gallery = gr.Gallery(
|
145 |
-
columns=
|
146 |
object_fit='scale-down',
|
147 |
label="Output image"
|
148 |
)
|
@@ -238,4 +246,4 @@ def main(_):
|
|
238 |
demo.launch()
|
239 |
|
240 |
if __name__ == "__main__":
|
241 |
-
mlxu.run(main)
|
|
|
47 |
use_lock=False,
|
48 |
)
|
49 |
|
50 |
+
checkerboard_r1 = np.concatenate([np.zeros((8, 8, 3)), np.ones((8, 8, 3)), np.zeros((8, 8, 3))], axis=1)
|
51 |
+
checkerboard_r2 = np.concatenate([np.ones((8, 8, 3)), np.zeros((8, 8, 3)), np.ones((8, 8, 3))], axis=1)
|
52 |
+
checkerboard = np.concatenate([checkerboard_r1, checkerboard_r2] * 16, axis=0).astype(np.float32)
|
53 |
+
|
54 |
def generate_images(input_images, n_new_frames, n_candidates, temperature=1.0, top_p=0.9):
|
55 |
assert len(input_images) > 0
|
56 |
input_images = [
|
|
|
62 |
|
63 |
generated_images = []
|
64 |
for candidate in output_images:
|
65 |
+
concatenated_image = []
|
66 |
+
for i, img in enumerate(candidate):
|
67 |
+
concatenated_image.append(img)
|
68 |
+
if i < len(candidate) - 1:
|
69 |
+
concatenated_image.append(checkerboard)
|
70 |
generated_images.append(
|
71 |
Image.fromarray(
|
72 |
+
(np.concatenate(concatenated_image, axis=1) * 255).astype(np.uint8)
|
73 |
)
|
74 |
)
|
75 |
|
|
|
150 |
)
|
151 |
gr.Markdown('## Outputs (multi candidates)')
|
152 |
output_gallery = gr.Gallery(
|
153 |
+
columns=4,
|
154 |
object_fit='scale-down',
|
155 |
label="Output image"
|
156 |
)
|
|
|
246 |
demo.launch()
|
247 |
|
248 |
if __name__ == "__main__":
|
249 |
+
mlxu.run(main)
|