Spaces:
Running
Running
gradio
Browse files- F5-TTS/src/f5_tts/infer/infer_cli_test.py +2 -0
- app.py +3 -2
F5-TTS/src/f5_tts/infer/infer_cli_test.py
CHANGED
|
@@ -14,6 +14,7 @@ from cached_path import cached_path
|
|
| 14 |
from omegaconf import OmegaConf
|
| 15 |
|
| 16 |
from moviepy.editor import VideoFileClip, AudioFileClip
|
|
|
|
| 17 |
|
| 18 |
|
| 19 |
from f5_tts.infer.utils_infer import (
|
|
@@ -495,6 +496,7 @@ if __name__ == "__main__":
|
|
| 495 |
wav_gen = torch.from_numpy(wav_gen).unsqueeze(0)
|
| 496 |
assert(sr_gen == 24000)
|
| 497 |
except:
|
|
|
|
| 498 |
print("error generation", i+args.start, txt_p, txt)
|
| 499 |
wav_gen = torch.zeros(1, 24000)
|
| 500 |
sr_gen = 24000
|
|
|
|
| 14 |
from omegaconf import OmegaConf
|
| 15 |
|
| 16 |
from moviepy.editor import VideoFileClip, AudioFileClip
|
| 17 |
+
import traceback
|
| 18 |
|
| 19 |
|
| 20 |
from f5_tts.infer.utils_infer import (
|
|
|
|
| 496 |
wav_gen = torch.from_numpy(wav_gen).unsqueeze(0)
|
| 497 |
assert(sr_gen == 24000)
|
| 498 |
except:
|
| 499 |
+
traceback.print_exc()
|
| 500 |
print("error generation", i+args.start, txt_p, txt)
|
| 501 |
wav_gen = torch.zeros(1, 24000)
|
| 502 |
sr_gen = 24000
|
app.py
CHANGED
|
@@ -71,10 +71,11 @@ def video_to_audio_and_speech(video: gr.Video, prompt: str, text: str, audio_pro
|
|
| 71 |
print("v2a command", command)
|
| 72 |
os.system(command)
|
| 73 |
|
|
|
|
|
|
|
| 74 |
command = "python ./F5-TTS/src/f5_tts/infer/infer_cli_test.py --output_dir %s --start 0 --end 1 --ckpt_file ./F5-TTS/ckpts/v2c/v2c_s44.pt --v2a_path %s --wav_p %s --txt_p \"%s\" --video %s --v2a_wav %s --txt \"%s\"" % (output_dir, output_dir, audio_p_path, text_prompt, video_save_path, video_save_path[:-4]+".flac", text)
|
| 75 |
-
print("v2s command", command)
|
| 76 |
os.system(command)
|
| 77 |
-
video_gen = output_dir + "/videos/gen/0001"
|
| 78 |
|
| 79 |
return video_save_path, video_gen
|
| 80 |
|
|
|
|
| 71 |
print("v2a command", command)
|
| 72 |
os.system(command)
|
| 73 |
|
| 74 |
+
video_gen = video_save_path[:-4]+".mp4.gen.mp4"
|
| 75 |
+
|
| 76 |
command = "python ./F5-TTS/src/f5_tts/infer/infer_cli_test.py --output_dir %s --start 0 --end 1 --ckpt_file ./F5-TTS/ckpts/v2c/v2c_s44.pt --v2a_path %s --wav_p %s --txt_p \"%s\" --video %s --v2a_wav %s --txt \"%s\"" % (output_dir, output_dir, audio_p_path, text_prompt, video_save_path, video_save_path[:-4]+".flac", text)
|
| 77 |
+
print("v2s command", command, video_gen)
|
| 78 |
os.system(command)
|
|
|
|
| 79 |
|
| 80 |
return video_save_path, video_gen
|
| 81 |
|