Spaces:
Running
on
Zero
Running
on
Zero
xiaozhongji
commited on
Commit
·
612b064
1
Parent(s):
836ed8b
update
Browse files- app.py +2 -3
- config/inference/sonic.yaml +1 -1
- sonic.py +1 -3
app.py
CHANGED
@@ -1,3 +1,4 @@
|
|
|
|
1 |
import gradio as gr
|
2 |
import os
|
3 |
import numpy as np
|
@@ -11,9 +12,6 @@ huggingface-cli download stabilityai/stable-video-diffusion-img2vid-xt --local-d
|
|
11 |
huggingface-cli download openai/whisper-tiny --local-dir checkpoints/whisper-tiny;'
|
12 |
os.system(cmd)
|
13 |
|
14 |
-
# import torch
|
15 |
-
# print('torch.cuda.device_count()', torch.cuda.device_count())
|
16 |
-
|
17 |
pipe = Sonic()
|
18 |
|
19 |
def get_md5(content):
|
@@ -21,6 +19,7 @@ def get_md5(content):
|
|
21 |
md5 = md5hash.hexdigest()
|
22 |
return md5
|
23 |
|
|
|
24 |
def get_video_res(img_path, audio_path, res_video_path, dynamic_scale=1.0):
|
25 |
|
26 |
expand_ratio = 0.5
|
|
|
1 |
+
import spaces
|
2 |
import gradio as gr
|
3 |
import os
|
4 |
import numpy as np
|
|
|
12 |
huggingface-cli download openai/whisper-tiny --local-dir checkpoints/whisper-tiny;'
|
13 |
os.system(cmd)
|
14 |
|
|
|
|
|
|
|
15 |
pipe = Sonic()
|
16 |
|
17 |
def get_md5(content):
|
|
|
19 |
md5 = md5hash.hexdigest()
|
20 |
return md5
|
21 |
|
22 |
+
@spaces.GPU(duration=120)
|
23 |
def get_video_res(img_path, audio_path, res_video_path, dynamic_scale=1.0):
|
24 |
|
25 |
expand_ratio = 0.5
|
config/inference/sonic.yaml
CHANGED
@@ -12,7 +12,7 @@ decode_chunk_size: 8
|
|
12 |
motion_bucket_scale: 1.0
|
13 |
image_size: 512
|
14 |
area: 1.1
|
15 |
-
frame_num:
|
16 |
step: 2
|
17 |
overlap: 0
|
18 |
shift_offset: 7
|
|
|
12 |
motion_bucket_scale: 1.0
|
13 |
image_size: 512
|
14 |
area: 1.1
|
15 |
+
frame_num: 50
|
16 |
step: 2
|
17 |
overlap: 0
|
18 |
shift_offset: 7
|
sonic.py
CHANGED
@@ -19,12 +19,10 @@ from src.models.audio_adapter.audio_proj import AudioProjModel
|
|
19 |
from src.models.audio_adapter.audio_to_bucket import Audio2bucketModel
|
20 |
from src.utils.RIFE.RIFE_HDv3 import RIFEModel
|
21 |
from src.dataset.face_align.align import AlignImage
|
22 |
-
import spaces
|
23 |
|
24 |
|
25 |
BASE_DIR = os.path.dirname(os.path.abspath(__file__))
|
26 |
|
27 |
-
@torch.no_grad()
|
28 |
def test(
|
29 |
pipe,
|
30 |
config,
|
@@ -256,7 +254,7 @@ class Sonic():
|
|
256 |
crop_image = face_image[crop_bbox[1]:crop_bbox[3], crop_bbox[0]:crop_bbox[2]]
|
257 |
cv2.imwrite(output_image_path, crop_image)
|
258 |
|
259 |
-
@
|
260 |
def process(self,
|
261 |
image_path,
|
262 |
audio_path,
|
|
|
19 |
from src.models.audio_adapter.audio_to_bucket import Audio2bucketModel
|
20 |
from src.utils.RIFE.RIFE_HDv3 import RIFEModel
|
21 |
from src.dataset.face_align.align import AlignImage
|
|
|
22 |
|
23 |
|
24 |
BASE_DIR = os.path.dirname(os.path.abspath(__file__))
|
25 |
|
|
|
26 |
def test(
|
27 |
pipe,
|
28 |
config,
|
|
|
254 |
crop_image = face_image[crop_bbox[1]:crop_bbox[3], crop_bbox[0]:crop_bbox[2]]
|
255 |
cv2.imwrite(output_image_path, crop_image)
|
256 |
|
257 |
+
@torch.no_grad()
|
258 |
def process(self,
|
259 |
image_path,
|
260 |
audio_path,
|