Spaces:
Configuration error
Configuration error
no message
Browse files
webui.py
CHANGED
|
@@ -136,6 +136,7 @@ def generate_audio(tts_text, mode_checkbox_group, sft_dropdown, prompt_text, pro
|
|
| 136 |
|
| 137 |
# SDK模型下载
|
| 138 |
import platform
|
|
|
|
| 139 |
python_version = platform.python_version()
|
| 140 |
print("Python version:", python_version)
|
| 141 |
from huggingface_hub import dump_environment_info
|
|
@@ -158,18 +159,22 @@ args = parser.parse_args()
|
|
| 158 |
|
| 159 |
cosyvoice_instance = None
|
| 160 |
model_dir=args.model_dir
|
|
|
|
|
|
|
| 161 |
@spaces.GPU
|
| 162 |
def get_cosyvoice():
|
| 163 |
global cosyvoice_instance, model_dir
|
| 164 |
-
|
| 165 |
-
|
|
|
|
|
|
|
| 166 |
return cosyvoice_instance
|
| 167 |
-
|
| 168 |
-
return CosyVoice(model_dir)
|
| 169 |
|
| 170 |
@spaces.GPU
|
| 171 |
def load_sft_options():
|
| 172 |
-
|
|
|
|
|
|
|
| 173 |
|
| 174 |
|
| 175 |
prompt_sr, target_sr = 16000, 22050
|
|
|
|
| 136 |
|
| 137 |
# SDK模型下载
|
| 138 |
import platform
|
| 139 |
+
import threading
|
| 140 |
python_version = platform.python_version()
|
| 141 |
print("Python version:", python_version)
|
| 142 |
from huggingface_hub import dump_environment_info
|
|
|
|
| 159 |
|
| 160 |
cosyvoice_instance = None
|
| 161 |
model_dir=args.model_dir
|
| 162 |
+
cosyvoice_lock = threading.Lock()
|
| 163 |
+
|
| 164 |
@spaces.GPU
|
| 165 |
def get_cosyvoice():
|
| 166 |
global cosyvoice_instance, model_dir
|
| 167 |
+
with cosyvoice_lock:
|
| 168 |
+
if cosyvoice_instance is not None:
|
| 169 |
+
return cosyvoice_instance
|
| 170 |
+
cosyvoice_instance=CosyVoice(model_dir)
|
| 171 |
return cosyvoice_instance
|
|
|
|
|
|
|
| 172 |
|
| 173 |
@spaces.GPU
|
| 174 |
def load_sft_options():
|
| 175 |
+
sound_choices=get_cosyvoice().list_avaliable_spks()
|
| 176 |
+
sound_choices_dict = {k:v for k, v in zip(sound_choices, sound_choices)}
|
| 177 |
+
return sound_choices_dict
|
| 178 |
|
| 179 |
|
| 180 |
prompt_sr, target_sr = 16000, 22050
|