Spaces:
Runtime error
Runtime error
Rename webui_colab.py to app.py
Browse files- webui_colab.py → app.py +5 -2
webui_colab.py → app.py
RENAMED
|
@@ -30,6 +30,8 @@ logging.getLogger('matplotlib').setLevel(logging.WARNING)
|
|
| 30 |
from cosyvoice.cli.cosyvoice import CosyVoice
|
| 31 |
from cosyvoice.utils.file_utils import load_wav
|
| 32 |
|
|
|
|
|
|
|
| 33 |
logging.basicConfig(level=logging.WARNING,
|
| 34 |
format='%(asctime)s %(levelname)s %(message)s')
|
| 35 |
|
|
@@ -66,6 +68,7 @@ instruct_dict = {'预训练音色': '1. 选择预训练音色\n2.点击生成音
|
|
| 66 |
def change_instruction(mode_checkbox_group):
|
| 67 |
return instruct_dict[mode_checkbox_group]
|
| 68 |
|
|
|
|
| 69 |
def generate_audio(tts_text, mode_checkbox_group, sft_dropdown, prompt_text, prompt_wav_upload, prompt_wav_record, instruct_text, seed):
|
| 70 |
tts_text = "".join([item for item in tts_text.strip().split("\n") if item != ""]) + ".。"
|
| 71 |
if prompt_wav_upload is not None:
|
|
@@ -173,8 +176,8 @@ def main():
|
|
| 173 |
</p>
|
| 174 |
</div>
|
| 175 |
''')
|
| 176 |
-
demo.queue()
|
| 177 |
-
demo.launch(
|
| 178 |
|
| 179 |
if __name__ == '__main__':
|
| 180 |
parser = argparse.ArgumentParser()
|
|
|
|
| 30 |
from cosyvoice.cli.cosyvoice import CosyVoice
|
| 31 |
from cosyvoice.utils.file_utils import load_wav
|
| 32 |
|
| 33 |
+
import spaces
|
| 34 |
+
|
| 35 |
logging.basicConfig(level=logging.WARNING,
|
| 36 |
format='%(asctime)s %(levelname)s %(message)s')
|
| 37 |
|
|
|
|
| 68 |
def change_instruction(mode_checkbox_group):
|
| 69 |
return instruct_dict[mode_checkbox_group]
|
| 70 |
|
| 71 |
+
@spaces.GPU
|
| 72 |
def generate_audio(tts_text, mode_checkbox_group, sft_dropdown, prompt_text, prompt_wav_upload, prompt_wav_record, instruct_text, seed):
|
| 73 |
tts_text = "".join([item for item in tts_text.strip().split("\n") if item != ""]) + ".。"
|
| 74 |
if prompt_wav_upload is not None:
|
|
|
|
| 176 |
</p>
|
| 177 |
</div>
|
| 178 |
''')
|
| 179 |
+
demo.queue(max_size=40, api_open=False)
|
| 180 |
+
demo.launch(max_threads=400, show_error=True)
|
| 181 |
|
| 182 |
if __name__ == '__main__':
|
| 183 |
parser = argparse.ArgumentParser()
|