Spaces:
Running
on
Zero
Running
on
Zero
zejunyang
commited on
Commit
•
5ef3823
1
Parent(s):
d61d34c
update
Browse files- src/audio2vid.py +2 -2
- src/vid2vid.py +2 -16
src/audio2vid.py
CHANGED
@@ -5,7 +5,7 @@ from pathlib import Path
|
|
5 |
import numpy as np
|
6 |
import cv2
|
7 |
import torch
|
8 |
-
|
9 |
from scipy.spatial.transform import Rotation as R
|
10 |
from scipy.interpolate import interp1d
|
11 |
|
@@ -91,7 +91,7 @@ def get_headpose_temp(input_video):
|
|
91 |
|
92 |
return pose_arr_smooth
|
93 |
|
94 |
-
|
95 |
def audio2video(input_audio, ref_img, headpose_video=None, size=512, steps=25, length=150, seed=42):
|
96 |
fps = 30
|
97 |
cfg = 3.5
|
|
|
5 |
import numpy as np
|
6 |
import cv2
|
7 |
import torch
|
8 |
+
import spaces
|
9 |
from scipy.spatial.transform import Rotation as R
|
10 |
from scipy.interpolate import interp1d
|
11 |
|
|
|
91 |
|
92 |
return pose_arr_smooth
|
93 |
|
94 |
+
@spaces.GPU
|
95 |
def audio2video(input_audio, ref_img, headpose_video=None, size=512, steps=25, length=150, seed=42):
|
96 |
fps = 30
|
97 |
cfg = 3.5
|
src/vid2vid.py
CHANGED
@@ -7,7 +7,7 @@ from pathlib import Path
|
|
7 |
import numpy as np
|
8 |
import cv2
|
9 |
import torch
|
10 |
-
|
11 |
from diffusers import AutoencoderKL, DDIMScheduler
|
12 |
from einops import repeat
|
13 |
from omegaconf import OmegaConf
|
@@ -27,21 +27,7 @@ from src.utils.pose_util import project_points_with_trans, matrix_to_euler_and_
|
|
27 |
from src.audio2vid import smooth_pose_seq
|
28 |
|
29 |
|
30 |
-
|
31 |
-
parser = argparse.ArgumentParser()
|
32 |
-
parser.add_argument("--config", type=str, default='./configs/prompts/animation_facereenac.yaml')
|
33 |
-
parser.add_argument("-W", type=int, default=512)
|
34 |
-
parser.add_argument("-H", type=int, default=512)
|
35 |
-
parser.add_argument("-L", type=int)
|
36 |
-
parser.add_argument("--seed", type=int, default=42)
|
37 |
-
parser.add_argument("--cfg", type=float, default=3.5)
|
38 |
-
parser.add_argument("--steps", type=int, default=25)
|
39 |
-
parser.add_argument("--fps", type=int)
|
40 |
-
args = parser.parse_args()
|
41 |
-
|
42 |
-
return args
|
43 |
-
|
44 |
-
# @spaces.GPU
|
45 |
def video2video(ref_img, source_video, size=512, steps=25, length=150, seed=42):
|
46 |
cfg = 3.5
|
47 |
|
|
|
7 |
import numpy as np
|
8 |
import cv2
|
9 |
import torch
|
10 |
+
import spaces
|
11 |
from diffusers import AutoencoderKL, DDIMScheduler
|
12 |
from einops import repeat
|
13 |
from omegaconf import OmegaConf
|
|
|
27 |
from src.audio2vid import smooth_pose_seq
|
28 |
|
29 |
|
30 |
+
@spaces.GPU
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
31 |
def video2video(ref_img, source_video, size=512, steps=25, length=150, seed=42):
|
32 |
cfg = 3.5
|
33 |
|