Spaces:
Running
on
A10G
Running
on
A10G
Update modules/sadtalker_test.py
Browse files
modules/sadtalker_test.py
CHANGED
@@ -7,6 +7,7 @@ from src.test_audio2coeff import Audio2Coeff
|
|
7 |
from src.facerender.animate import AnimateFromCoeff
|
8 |
from src.generate_batch import get_data
|
9 |
from src.generate_facerender_batch import get_facerender_data
|
|
|
10 |
|
11 |
from pydub import AudioSegment
|
12 |
|
@@ -25,8 +26,8 @@ class SadTalker():
|
|
25 |
else:
|
26 |
device = "cpu"
|
27 |
|
28 |
-
current_code_path = sys.argv[0]
|
29 |
-
modules_path = os.path.split(current_code_path)[0]
|
30 |
|
31 |
current_root_path = './'
|
32 |
|
@@ -61,7 +62,7 @@ class SadTalker():
|
|
61 |
|
62 |
def test(self, source_image, driven_audio, still_mode, use_enhancer, result_dir='./'):
|
63 |
|
64 |
-
time_tag = strftime("%Y_%m_%d_%H.%M.%S")
|
65 |
save_dir = os.path.join(result_dir, time_tag)
|
66 |
os.makedirs(save_dir, exist_ok=True)
|
67 |
|
@@ -106,6 +107,7 @@ class SadTalker():
|
|
106 |
|
107 |
torch.cuda.empty_cache()
|
108 |
torch.cuda.synchronize()
|
|
|
109 |
import gc; gc.collect()
|
110 |
|
111 |
if use_enhancer:
|
|
|
7 |
from src.facerender.animate import AnimateFromCoeff
|
8 |
from src.generate_batch import get_data
|
9 |
from src.generate_facerender_batch import get_facerender_data
|
10 |
+
import uuid
|
11 |
|
12 |
from pydub import AudioSegment
|
13 |
|
|
|
26 |
else:
|
27 |
device = "cpu"
|
28 |
|
29 |
+
# current_code_path = sys.argv[0]
|
30 |
+
# modules_path = os.path.split(current_code_path)[0]
|
31 |
|
32 |
current_root_path = './'
|
33 |
|
|
|
62 |
|
63 |
def test(self, source_image, driven_audio, still_mode, use_enhancer, result_dir='./'):
|
64 |
|
65 |
+
time_tag = str(uuid.uuid4()) # strftime("%Y_%m_%d_%H.%M.%S")
|
66 |
save_dir = os.path.join(result_dir, time_tag)
|
67 |
os.makedirs(save_dir, exist_ok=True)
|
68 |
|
|
|
107 |
|
108 |
torch.cuda.empty_cache()
|
109 |
torch.cuda.synchronize()
|
110 |
+
|
111 |
import gc; gc.collect()
|
112 |
|
113 |
if use_enhancer:
|