Omnibus commited on
Commit
6e5ae84
·
verified ·
1 Parent(s): 0171a9f

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +12 -11
app.py CHANGED
@@ -103,8 +103,9 @@ def make_animation():
103
  get_url=f'{main_directory}images/animations/'
104
  feed1 = requests.get(get_url)
105
  spl = feed1.text.split("href=")
106
- gif_box=[]
107
  for line in spl:
 
 
108
  spl2 = line.split(">")[0].strip('""')
109
  if spl2.endswith("/"):
110
  feed2 = requests.get(f'{get_url}{spl2}')
@@ -114,16 +115,16 @@ def make_animation():
114
  if spl3.endswith(".png") or spl3.endswith(".gif") or spl3.endswith(".jpg"):
115
  gif_box.append(f'{get_url}{spl2}{spl3}')
116
 
117
- #frames = [Image.open(image) for image in glob.glob(f"{frame_folder}/*.JPG")]
118
- frames = []
119
- for i,ea in enumerate(gif_box):
120
- urllib.request.urlretrieve(ea,f'tmp{i}.png')
121
- frames.append(Image.open("gfg.png"))
122
- frame_one = frames[0]
123
- filename=f'{spl3.split(".")[0]}.gif'
124
- frame_one.save(filename, format="GIF", append_images=frames,
125
- save_all=True, duration=100, loop=0)
126
- html_out+=f'<div class="img_class"><img src="{filename}"></div>'
127
  html_out+='</div>'
128
  return html_out
129
 
 
103
  get_url=f'{main_directory}images/animations/'
104
  feed1 = requests.get(get_url)
105
  spl = feed1.text.split("href=")
 
106
  for line in spl:
107
+ gif_box=[]
108
+
109
  spl2 = line.split(">")[0].strip('""')
110
  if spl2.endswith("/"):
111
  feed2 = requests.get(f'{get_url}{spl2}')
 
115
  if spl3.endswith(".png") or spl3.endswith(".gif") or spl3.endswith(".jpg"):
116
  gif_box.append(f'{get_url}{spl2}{spl3}')
117
 
118
+ #frames = [Image.open(image) for image in glob.glob(f"{frame_folder}/*.JPG")]
119
+ frames = []
120
+ for i,ea in enumerate(gif_box):
121
+ urllib.request.urlretrieve(ea,f'tmp{i}.png')
122
+ frames.append(Image.open(f'tmp{i}.png'))
123
+ frame_one = frames[0]
124
+ filename=f'{spl3.split(".")[0]}.gif'
125
+ frame_one.save(filename, format="GIF", append_images=frames,
126
+ save_all=True, duration=100, loop=0)
127
+ html_out+=f'<div class="img_class"><img src="{filename}"></div>'
128
  html_out+='</div>'
129
  return html_out
130