Omnibus commited on
Commit
77b6da3
·
verified ·
1 Parent(s): 6def092

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +15 -15
app.py CHANGED
@@ -116,21 +116,21 @@ def make_animation():
116
  print(spl3)
117
  if spl3.endswith(".png") or spl3.endswith(".gif") or spl3.endswith(".jpg"):
118
  gif_box.append(f'{get_url}{spl2}{spl3}')
119
-
120
- #frames = [Image.open(image) for image in glob.glob(f"{frame_folder}/*.JPG")]
121
- frames = []
122
- for i,ea in enumerate(gif_box):
123
- print("############")
124
- print(ea)
125
- urllib.request.urlretrieve(ea,f'tmp{i}.png')
126
- frames.append(Image.open(f'tmp{i}.png'))
127
- frame_one = frames[0]
128
- filename=f'{spl3.split(".")[0]}.gif'
129
- print("**************")
130
- print(filename)
131
- frame_one.save(filename, format="GIF", append_images=frames,
132
- save_all=True, duration=100, loop=0)
133
- html_out+=f'<div class="img_class"><img src="{filename}"></div>'
134
  html_out+='</div>'
135
  return html_out
136
 
 
116
  print(spl3)
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
+ #frames = [Image.open(image) for image in glob.glob(f"{frame_folder}/*.JPG")]
121
+ frames = []
122
+ for i,ea in enumerate(gif_box):
123
+ print("############")
124
+ print(ea)
125
+ urllib.request.urlretrieve(ea,f'tmp{i}.png')
126
+ frames.append(Image.open(f'tmp{i}.png'))
127
+ frame_one = frames[0]
128
+ filename=f'{spl3.split(".")[0]}.gif'
129
+ print("**************")
130
+ print(filename)
131
+ frame_one.save(filename, format="GIF", append_images=frames,
132
+ save_all=True, duration=100, loop=0)
133
+ html_out+=f'<div class="img_class"><img src="{filename}"></div>'
134
  html_out+='</div>'
135
  return html_out
136