Spaces:
Runtime error
Runtime error
Commit
·
100ddf0
1
Parent(s):
27be903
remove intermediate tensors
Browse files
app.py
CHANGED
|
@@ -228,7 +228,10 @@ def generate_video_from_text(
|
|
| 228 |
for frame in video_np[..., ::-1]:
|
| 229 |
out.write(frame)
|
| 230 |
out.release()
|
| 231 |
-
|
|
|
|
|
|
|
|
|
|
| 232 |
return output_path
|
| 233 |
|
| 234 |
|
|
@@ -299,6 +302,11 @@ def generate_video_from_image(
|
|
| 299 |
out.write(frame)
|
| 300 |
out.release()
|
| 301 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 302 |
return output_path
|
| 303 |
|
| 304 |
|
|
|
|
| 228 |
for frame in video_np[..., ::-1]:
|
| 229 |
out.write(frame)
|
| 230 |
out.release()
|
| 231 |
+
# Explicitly delete tensors and clear cache
|
| 232 |
+
del images
|
| 233 |
+
del video_np
|
| 234 |
+
torch.cuda.empty_cache()
|
| 235 |
return output_path
|
| 236 |
|
| 237 |
|
|
|
|
| 302 |
out.write(frame)
|
| 303 |
out.release()
|
| 304 |
|
| 305 |
+
# Explicitly delete tensors and clear cache
|
| 306 |
+
del images
|
| 307 |
+
del video_np
|
| 308 |
+
torch.cuda.empty_cache()
|
| 309 |
+
|
| 310 |
return output_path
|
| 311 |
|
| 312 |
|