Spaces:
Runtime error
Runtime error
Update app.py
Browse files
app.py
CHANGED
@@ -4,6 +4,8 @@ import json
|
|
4 |
import os
|
5 |
from PIL import Image
|
6 |
import moviepy.video.io.ImageSequenceClip as ic
|
|
|
|
|
7 |
|
8 |
import urllib.request
|
9 |
import uuid
|
@@ -138,10 +140,14 @@ def make_animation():
|
|
138 |
uid=uuid.uuid4()
|
139 |
clip = ic.ImageSequenceClip(frames, fps = fps)
|
140 |
clip.to_gif(f"{uid}.gif",fps=fps)
|
|
|
|
|
|
|
|
|
|
|
141 |
|
142 |
-
|
143 |
#frame_one.save(filename, format="GIF", append_images=frames, save_all=True, duration=100, loop=0)
|
144 |
-
html_out+=f'<div class="img_class"><img src="{
|
145 |
except Exception as e:
|
146 |
print(e)
|
147 |
html_out+='</div>'
|
|
|
4 |
import os
|
5 |
from PIL import Image
|
6 |
import moviepy.video.io.ImageSequenceClip as ic
|
7 |
+
from pathlib import Path
|
8 |
+
|
9 |
|
10 |
import urllib.request
|
11 |
import uuid
|
|
|
140 |
uid=uuid.uuid4()
|
141 |
clip = ic.ImageSequenceClip(frames, fps = fps)
|
142 |
clip.to_gif(f"{uid}.gif",fps=fps)
|
143 |
+
current_file_path = Path(f"{uid}.gif").resolve()
|
144 |
+
print(current_file_path)
|
145 |
+
#relative_path = "path/to/file"
|
146 |
+
absolute_path = (current_file_path.parent / ".." / ".." / "gradio").resolve()
|
147 |
+
print(absolute_path)
|
148 |
|
|
|
149 |
#frame_one.save(filename, format="GIF", append_images=frames, save_all=True, duration=100, loop=0)
|
150 |
+
html_out+=f'<div class="img_class"><img src="{current_file_path}"></div>'
|
151 |
except Exception as e:
|
152 |
print(e)
|
153 |
html_out+='</div>'
|