Spaces:
Running
on
Zero
Running
on
Zero
刘悦
commited on
Commit
•
cdd9a01
1
Parent(s):
f2939a9
Update webui.py
Browse files
webui.py
CHANGED
@@ -28,7 +28,7 @@ import logging
|
|
28 |
logging.getLogger('matplotlib').setLevel(logging.WARNING)
|
29 |
|
30 |
from cosyvoice.cli.cosyvoice import CosyVoice
|
31 |
-
from cosyvoice.utils.file_utils import load_wav,speed_change
|
32 |
|
33 |
logging.basicConfig(level=logging.DEBUG,
|
34 |
format='%(asctime)s %(levelname)s %(message)s')
|
@@ -135,7 +135,7 @@ def generate_audio(tts_text, mode_checkbox_group, sft_dropdown, prompt_text, pro
|
|
135 |
|
136 |
if speed_factor != 1.0:
|
137 |
try:
|
138 |
-
audio_data
|
139 |
audio_data = audio_data.numpy().flatten()
|
140 |
except Exception as e:
|
141 |
print(f"Failed to change speed of audio: \n{e}")
|
@@ -171,7 +171,7 @@ def main():
|
|
171 |
|
172 |
seed_button.click(generate_seed, inputs=[], outputs=seed)
|
173 |
generate_button.click(generate_audio,
|
174 |
-
inputs=[tts_text, mode_checkbox_group, sft_dropdown, prompt_text, prompt_wav_upload, prompt_wav_record, instruct_text, seed,speed_factor],
|
175 |
outputs=[audio_output])
|
176 |
mode_checkbox_group.change(fn=change_instruction, inputs=[mode_checkbox_group], outputs=[instruction_text])
|
177 |
demo.queue(max_size=4, default_concurrency_limit=2)
|
|
|
28 |
logging.getLogger('matplotlib').setLevel(logging.WARNING)
|
29 |
|
30 |
from cosyvoice.cli.cosyvoice import CosyVoice
|
31 |
+
from cosyvoice.utils.file_utils import load_wav, speed_change
|
32 |
|
33 |
logging.basicConfig(level=logging.DEBUG,
|
34 |
format='%(asctime)s %(levelname)s %(message)s')
|
|
|
135 |
|
136 |
if speed_factor != 1.0:
|
137 |
try:
|
138 |
+
audio_data, sample_rate = speed_change(output["tts_speech"], target_sr, str(speed_factor))
|
139 |
audio_data = audio_data.numpy().flatten()
|
140 |
except Exception as e:
|
141 |
print(f"Failed to change speed of audio: \n{e}")
|
|
|
171 |
|
172 |
seed_button.click(generate_seed, inputs=[], outputs=seed)
|
173 |
generate_button.click(generate_audio,
|
174 |
+
inputs=[tts_text, mode_checkbox_group, sft_dropdown, prompt_text, prompt_wav_upload, prompt_wav_record, instruct_text, seed, speed_factor],
|
175 |
outputs=[audio_output])
|
176 |
mode_checkbox_group.change(fn=change_instruction, inputs=[mode_checkbox_group], outputs=[instruction_text])
|
177 |
demo.queue(max_size=4, default_concurrency_limit=2)
|