Spaces:
Runtime error
Runtime error
Update app.py
Browse files
app.py
CHANGED
@@ -117,20 +117,23 @@ def make_animation():
|
|
117 |
if spl3.endswith(".png") or spl3.endswith(".gif") or spl3.endswith(".jpg"):
|
118 |
gif_box.append(f'{get_url}{spl2}{spl3}')
|
119 |
if gif_box:
|
120 |
-
|
121 |
-
|
122 |
-
|
123 |
-
|
124 |
-
|
125 |
-
|
126 |
-
|
127 |
-
|
128 |
-
|
129 |
-
|
130 |
-
|
131 |
-
|
132 |
-
|
133 |
-
|
|
|
|
|
|
|
134 |
html_out+='</div>'
|
135 |
return html_out
|
136 |
|
|
|
117 |
if spl3.endswith(".png") or spl3.endswith(".gif") or spl3.endswith(".jpg"):
|
118 |
gif_box.append(f'{get_url}{spl2}{spl3}')
|
119 |
if gif_box:
|
120 |
+
try:
|
121 |
+
#frames = [Image.open(image) for image in glob.glob(f"{frame_folder}/*.JPG")]
|
122 |
+
frames = []
|
123 |
+
for i,ea in enumerate(gif_box):
|
124 |
+
print("############")
|
125 |
+
print(ea)
|
126 |
+
urllib.request.urlretrieve(ea,f'tmp{i}.png')
|
127 |
+
frames.append(Image.open(f'tmp{i}.png'))
|
128 |
+
frame_one = frames[0]
|
129 |
+
filename=f'{spl3.split(".")[0]}.gif'
|
130 |
+
print("**************")
|
131 |
+
print(filename)
|
132 |
+
frame_one.save(filename, format="GIF", append_images=frames,
|
133 |
+
save_all=True, duration=100, loop=0)
|
134 |
+
html_out+=f'<div class="img_class"><img src="{filename}"></div>'
|
135 |
+
except Exception as e:
|
136 |
+
print(e)
|
137 |
html_out+='</div>'
|
138 |
return html_out
|
139 |
|