Spaces:
Running
Running
Update app.py
Browse files
app.py
CHANGED
@@ -1,5 +1,20 @@
|
|
1 |
import zipfile
|
2 |
import subprocess
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
3 |
import gradio as gr
|
4 |
import numpy as np
|
5 |
import torch
|
@@ -27,20 +42,7 @@ from taming.models.vqgan import VQModel
|
|
27 |
|
28 |
device = torch.device("cuda" if torch.cuda.is_available() else "cpu")
|
29 |
|
30 |
-
|
31 |
-
try:
|
32 |
-
print("Attempting to unzip content using Python...")
|
33 |
-
with zipfile.ZipFile('./content.zip', 'r') as zip_ref:
|
34 |
-
zip_ref.extractall('.')
|
35 |
-
except Exception as e:
|
36 |
-
print(f"Python unzip failed: {str(e)}")
|
37 |
-
try:
|
38 |
-
print("Attempting to unzip content using system command...")
|
39 |
-
subprocess.run(['unzip', '-o', './content.zip'], check=True)
|
40 |
-
except Exception as e:
|
41 |
-
print(f"System unzip failed: {str(e)}")
|
42 |
-
raise Exception("Failed to unzip content using both methods")
|
43 |
-
print("Content successfully unzipped!")
|
44 |
|
45 |
def create_video(images_list, video_name='morphing_video.mp4'):
|
46 |
"""Create video from a list of image tensors"""
|
|
|
1 |
import zipfile
|
2 |
import subprocess
|
3 |
+
def unzip_content():
|
4 |
+
try:
|
5 |
+
print("Attempting to unzip content using Python...")
|
6 |
+
with zipfile.ZipFile('./content.zip', 'r') as zip_ref:
|
7 |
+
zip_ref.extractall('.')
|
8 |
+
except Exception as e:
|
9 |
+
print(f"Python unzip failed: {str(e)}")
|
10 |
+
try:
|
11 |
+
print("Attempting to unzip content using system command...")
|
12 |
+
subprocess.run(['unzip', '-o', './content.zip'], check=True)
|
13 |
+
except Exception as e:
|
14 |
+
print(f"System unzip failed: {str(e)}")
|
15 |
+
raise Exception("Failed to unzip content using both methods")
|
16 |
+
print("Content successfully unzipped!")
|
17 |
+
import subprocess
|
18 |
import gradio as gr
|
19 |
import numpy as np
|
20 |
import torch
|
|
|
42 |
|
43 |
device = torch.device("cuda" if torch.cuda.is_available() else "cpu")
|
44 |
|
45 |
+
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
46 |
|
47 |
def create_video(images_list, video_name='morphing_video.mp4'):
|
48 |
"""Create video from a list of image tensors"""
|