Spaces:
Runtime error
Runtime error
Update FantasyTalking/infer.py
Browse files- FantasyTalking/infer.py +8 -4
FantasyTalking/infer.py
CHANGED
|
@@ -164,7 +164,6 @@ def load_models(args):
|
|
| 164 |
return pipe, fantasytalking, wav2vec_processor, wav2vec
|
| 165 |
|
| 166 |
|
| 167 |
-
|
| 168 |
def main(args, pipe, fantasytalking, wav2vec_processor, wav2vec):
|
| 169 |
os.makedirs(args.output_dir, exist_ok=True)
|
| 170 |
|
|
@@ -183,12 +182,16 @@ def main(args, pipe, fantasytalking, wav2vec_processor, wav2vec):
|
|
| 183 |
)
|
| 184 |
audio_proj_split, audio_context_lens = fantasytalking.split_tensor_with_padding(
|
| 185 |
audio_proj_fea, pos_idx_ranges, expand_length=4
|
| 186 |
-
)
|
| 187 |
|
| 188 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
| 189 |
video_audio = pipe(
|
| 190 |
prompt=args.prompt,
|
| 191 |
-
negative_prompt="
|
| 192 |
input_image=image,
|
| 193 |
width=width,
|
| 194 |
height=height,
|
|
@@ -227,6 +230,7 @@ def main(args, pipe, fantasytalking, wav2vec_processor, wav2vec):
|
|
| 227 |
return save_path
|
| 228 |
|
| 229 |
|
|
|
|
| 230 |
if __name__ == "__main__":
|
| 231 |
args = parse_args()
|
| 232 |
pipe, fantasytalking, wav2vec_processor, wav2vec = load_models(args)
|
|
|
|
| 164 |
return pipe, fantasytalking, wav2vec_processor, wav2vec
|
| 165 |
|
| 166 |
|
|
|
|
| 167 |
def main(args, pipe, fantasytalking, wav2vec_processor, wav2vec):
|
| 168 |
os.makedirs(args.output_dir, exist_ok=True)
|
| 169 |
|
|
|
|
| 182 |
)
|
| 183 |
audio_proj_split, audio_context_lens = fantasytalking.split_tensor_with_padding(
|
| 184 |
audio_proj_fea, pos_idx_ranges, expand_length=4
|
| 185 |
+
)
|
| 186 |
|
| 187 |
+
if pipe is None:
|
| 188 |
+
print("❌ Pipe is None: Video generation skipped because Wan model is not loaded.")
|
| 189 |
+
return None
|
| 190 |
+
|
| 191 |
+
# إذا كان عندك pipe نكمل توليد الفيديو
|
| 192 |
video_audio = pipe(
|
| 193 |
prompt=args.prompt,
|
| 194 |
+
negative_prompt="...",
|
| 195 |
input_image=image,
|
| 196 |
width=width,
|
| 197 |
height=height,
|
|
|
|
| 230 |
return save_path
|
| 231 |
|
| 232 |
|
| 233 |
+
|
| 234 |
if __name__ == "__main__":
|
| 235 |
args = parse_args()
|
| 236 |
pipe, fantasytalking, wav2vec_processor, wav2vec = load_models(args)
|