Spaces:
Running
on
Zero
Running
on
Zero
Update stf_utils.py
Browse files- stf_utils.py +30 -13
stf_utils.py
CHANGED
|
@@ -78,25 +78,42 @@ class STFPipeline:
|
|
| 78 |
|
| 79 |
):
|
| 80 |
|
| 81 |
-
config_path = os.path.join(stf_path, config_path)
|
| 82 |
-
checkpoint_path = os.path.join(stf_path, checkpoint_path)
|
| 83 |
-
work_root_path = os.path.join(stf_path, root_path)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 84 |
|
| 85 |
model = stf_alternative.create_model(
|
| 86 |
-
|
| 87 |
-
|
| 88 |
-
|
| 89 |
-
|
| 90 |
-
|
| 91 |
)
|
| 92 |
self.template = stf_alternative.Template(
|
| 93 |
-
|
| 94 |
-
|
| 95 |
-
|
| 96 |
)
|
| 97 |
-
|
| 98 |
|
| 99 |
-
|
| 100 |
Path("dubbing").mkdir(exist_ok=True)
|
| 101 |
save_path = os.path.join("dubbing", Path(audio).stem+"--lip.mp4")
|
| 102 |
reader = iter(self.template._get_reader(num_skip_frames=0))
|
|
|
|
| 78 |
|
| 79 |
):
|
| 80 |
|
| 81 |
+
self.config_path = os.path.join(stf_path, config_path)
|
| 82 |
+
self.checkpoint_path = os.path.join(stf_path, checkpoint_path)
|
| 83 |
+
self.work_root_path = os.path.join(stf_path, root_path)
|
| 84 |
+
self.device = device
|
| 85 |
+
self.template_video_path=template_video_path
|
| 86 |
+
|
| 87 |
+
# model = stf_alternative.create_model(
|
| 88 |
+
# config_path=config_path,
|
| 89 |
+
# checkpoint_path=checkpoint_path,
|
| 90 |
+
# work_root_path=work_root_path,
|
| 91 |
+
# device=device,
|
| 92 |
+
# wavlm_path="microsoft/wavlm-large",
|
| 93 |
+
# )
|
| 94 |
+
# self.template = stf_alternative.Template(
|
| 95 |
+
# model=model,
|
| 96 |
+
# config_path=config_path,
|
| 97 |
+
# template_video_path=template_video_path,
|
| 98 |
+
# )
|
| 99 |
+
|
| 100 |
+
|
| 101 |
+
def execute(self, audio: str):
|
| 102 |
|
| 103 |
model = stf_alternative.create_model(
|
| 104 |
+
config_path=self.config_path,
|
| 105 |
+
checkpoint_path=self.checkpoint_path,
|
| 106 |
+
work_root_path=self.work_root_path,
|
| 107 |
+
device=self.device,
|
| 108 |
+
wavlm_path="microsoft/wavlm-large",
|
| 109 |
)
|
| 110 |
self.template = stf_alternative.Template(
|
| 111 |
+
model=model,
|
| 112 |
+
config_path=self.config_path,
|
| 113 |
+
template_video_path=self.template_video_path,
|
| 114 |
)
|
|
|
|
| 115 |
|
| 116 |
+
|
| 117 |
Path("dubbing").mkdir(exist_ok=True)
|
| 118 |
save_path = os.path.join("dubbing", Path(audio).stem+"--lip.mp4")
|
| 119 |
reader = iter(self.template._get_reader(num_skip_frames=0))
|