Spaces:
Running
Running
gradio
Browse files- F5-TTS/src/f5_tts/infer/infer_cli_test.py +2 -0
- app.py +10 -4
F5-TTS/src/f5_tts/infer/infer_cli_test.py
CHANGED
@@ -257,6 +257,8 @@ sway_sampling_coef = args.sway_sampling_coef or config.get("sway_sampling_coef",
|
|
257 |
speed = args.speed or config.get("speed", speed)
|
258 |
fix_duration = args.fix_duration or config.get("fix_duration", fix_duration)
|
259 |
|
|
|
|
|
260 |
|
261 |
# patches for pip pkg user
|
262 |
if "infer/examples/" in ref_audio:
|
|
|
257 |
speed = args.speed or config.get("speed", speed)
|
258 |
fix_duration = args.fix_duration or config.get("fix_duration", fix_duration)
|
259 |
|
260 |
+
print("############nfe_step", nfe_step)
|
261 |
+
|
262 |
|
263 |
# patches for pip pkg user
|
264 |
if "infer/examples/" in ref_audio:
|
app.py
CHANGED
@@ -35,7 +35,7 @@ log = logging.getLogger()
|
|
35 |
|
36 |
|
37 |
#@spaces.GPU(duration=120)
|
38 |
-
def video_to_audio_and_speech(video: gr.Video, prompt: str, text: str, audio_prompt: gr.Audio, text_prompt: str):
|
39 |
|
40 |
video_path = tempfile.NamedTemporaryFile(delete=False, suffix='.mp4').name
|
41 |
|
@@ -65,15 +65,15 @@ def video_to_audio_and_speech(video: gr.Video, prompt: str, text: str, audio_pro
|
|
65 |
shutil.copy(audio_prompt, audio_p_path)
|
66 |
|
67 |
if prompt == "":
|
68 |
-
command = "cd ./MMAudio; python ./demo.py --variant small_44k --output %s --video %s --calc_energy 1" % (output_dir, video_path)
|
69 |
else:
|
70 |
-
command = "cd ./MMAudio; python ./demo.py --variant small_44k --output %s --video %s --prompt %s --calc_energy 1" % (output_dir, video_path, prompt)
|
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 |
|
@@ -89,9 +89,11 @@ video_to_audio_and_speech_tab = gr.Interface(
|
|
89 |
inputs=[
|
90 |
gr.Video(label="Input Video"),
|
91 |
gr.Text(label='Video-to-Audio Text Prompt'),
|
|
|
92 |
gr.Text(label='Video-to-Speech Transcription'),
|
93 |
gr.Audio(label='Video-to-Speech Speech Prompt'),
|
94 |
gr.Text(label='Video-to-Speech Speech Prompt Transcription'),
|
|
|
95 |
],
|
96 |
outputs=[
|
97 |
gr.Video(label="Video-to-Audio Output"),
|
@@ -103,16 +105,20 @@ video_to_audio_and_speech_tab = gr.Interface(
|
|
103 |
[
|
104 |
'./tests/0235.mp4',
|
105 |
'',
|
|
|
106 |
"Who finally decided to show up for work Yay",
|
107 |
'./tests/Gobber-00-0778.wav',
|
108 |
"I've still got a few knocking around in here",
|
|
|
109 |
],
|
110 |
[
|
111 |
'./tests/0778.mp4',
|
112 |
'',
|
|
|
113 |
"I've still got a few knocking around in here",
|
114 |
'./tests/Gobber-00-0235.wav',
|
115 |
"Who finally decided to show up for work Yay",
|
|
|
116 |
],
|
117 |
])
|
118 |
|
|
|
35 |
|
36 |
|
37 |
#@spaces.GPU(duration=120)
|
38 |
+
def video_to_audio_and_speech(video: gr.Video, prompt: str, v2a_num_steps: int, text: str, audio_prompt: gr.Audio, text_prompt: str, v2s_num_steps: int):
|
39 |
|
40 |
video_path = tempfile.NamedTemporaryFile(delete=False, suffix='.mp4').name
|
41 |
|
|
|
65 |
shutil.copy(audio_prompt, audio_p_path)
|
66 |
|
67 |
if prompt == "":
|
68 |
+
command = "cd ./MMAudio; python ./demo.py --variant small_44k --output %s --video %s --calc_energy 1 --num_steps %d" % (output_dir, video_path, v2a_num_steps)
|
69 |
else:
|
70 |
+
command = "cd ./MMAudio; python ./demo.py --variant small_44k --output %s --video %s --prompt %s --calc_energy 1 --num_steps %d" % (output_dir, video_path, prompt, v2a_num_steps)
|
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\" --nfe_step %d" % (output_dir, output_dir, audio_p_path, text_prompt, video_save_path, video_save_path[:-4]+".flac", text, v2s_num_steps)
|
77 |
print("v2s command", command, video_gen)
|
78 |
os.system(command)
|
79 |
|
|
|
89 |
inputs=[
|
90 |
gr.Video(label="Input Video"),
|
91 |
gr.Text(label='Video-to-Audio Text Prompt'),
|
92 |
+
gr.Number(label='Video-to-Audio Num Steps', value=25, precision=0, minimum=1),
|
93 |
gr.Text(label='Video-to-Speech Transcription'),
|
94 |
gr.Audio(label='Video-to-Speech Speech Prompt'),
|
95 |
gr.Text(label='Video-to-Speech Speech Prompt Transcription'),
|
96 |
+
gr.Number(label='Video-to-Speech Num Steps', value=32, precision=0, minimum=1),
|
97 |
],
|
98 |
outputs=[
|
99 |
gr.Video(label="Video-to-Audio Output"),
|
|
|
105 |
[
|
106 |
'./tests/0235.mp4',
|
107 |
'',
|
108 |
+
25,
|
109 |
"Who finally decided to show up for work Yay",
|
110 |
'./tests/Gobber-00-0778.wav',
|
111 |
"I've still got a few knocking around in here",
|
112 |
+
32,
|
113 |
],
|
114 |
[
|
115 |
'./tests/0778.mp4',
|
116 |
'',
|
117 |
+
25,
|
118 |
"I've still got a few knocking around in here",
|
119 |
'./tests/Gobber-00-0235.wav',
|
120 |
"Who finally decided to show up for work Yay",
|
121 |
+
32,
|
122 |
],
|
123 |
])
|
124 |
|