broadfield-dev commited on
Commit
a1c1a15
·
verified ·
1 Parent(s): 2ebe379

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +7 -5
app.py CHANGED
@@ -139,11 +139,13 @@ def make_animation(url1="",url2="",url3="",url4="",url5="",url6="",url7="",url8=
139
  clip = ic.ImageSequenceClip(frames, fps = fps)
140
 
141
 
142
- # Generate GIF in memory
143
- gif_buffer = io.BytesIO()
144
- clip.write_gif(gif_buffer, fps=fps)
145
- gif_bytes = gif_buffer.getvalue()
146
- gif_buffer.close()
 
 
147
 
148
  # Encode GIF bytes as base64 for HTML
149
  gif_base64 = base64.b64encode(gif_bytes).decode('utf-8')
 
139
  clip = ic.ImageSequenceClip(frames, fps = fps)
140
 
141
 
142
+ # Save GIF to a temporary file
143
+ temp_gif_path = f"temp_{uid}.gif"
144
+ clip.write_gif(temp_gif_path, fps=fps)
145
+
146
+ # Read the GIF file into bytes
147
+ with open(temp_gif_path, 'rb') as gif_file:
148
+ gif_bytes = gif_file.read()
149
 
150
  # Encode GIF bytes as base64 for HTML
151
  gif_base64 = base64.b64encode(gif_bytes).decode('utf-8')