app
Browse files
app.py
CHANGED
@@ -234,24 +234,22 @@ def infer(
|
|
234 |
samples = unpreprocess(image_unprocessed).contiguous()
|
235 |
|
236 |
|
237 |
-
|
238 |
-
|
239 |
-
|
240 |
-
|
241 |
-
|
242 |
-
|
243 |
-
|
244 |
-
|
245 |
-
|
246 |
-
|
247 |
-
|
248 |
-
|
249 |
-
|
250 |
-
|
251 |
-
|
252 |
-
|
253 |
-
|
254 |
-
return pil_image, seed
|
255 |
|
256 |
|
257 |
# examples = [
|
|
|
234 |
samples = unpreprocess(image_unprocessed).contiguous()
|
235 |
|
236 |
|
237 |
+
to_pil = ToPILImage()
|
238 |
+
pil_images = [to_pil(img) for img in samples]
|
239 |
+
|
240 |
+
# Get the first and last images
|
241 |
+
first_image = pil_images[0]
|
242 |
+
last_image = pil_images[-1]
|
243 |
+
|
244 |
+
# Create an animated GIF from all the PIL images
|
245 |
+
# gif_buffer = io.BytesIO()
|
246 |
+
# # duration: adjust duration (ms) between frames as needed
|
247 |
+
# pil_images[0].save(gif_buffer, format="GIF", save_all=True, append_images=pil_images[1:], duration=10, loop=0)
|
248 |
+
# gif_buffer.seek(0)
|
249 |
+
# gif_bytes = gif_buffer.read()
|
250 |
+
|
251 |
+
# return first_image, last_image, gif_bytes, seed
|
252 |
+
return first_image, last_image, seed
|
|
|
|
|
253 |
|
254 |
|
255 |
# examples = [
|