From 091e73caa9b31c4a97ac06729d7c229f73952f9e Mon Sep 17 00:00:00 2001 From: "kevin.zhang" Date: Thu, 16 May 2024 13:58:34 +0800 Subject: [PATCH] chore: fix --- api_v3.py | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/api_v3.py b/api_v3.py index 43f20438..a121dfc4 100644 --- a/api_v3.py +++ b/api_v3.py @@ -421,7 +421,8 @@ async def tts_post_endpoint(request: TTS_Request): @APP.get("/set_refer_audio") async def set_refer_audio(refer_audio_path: str = None, tts_infer_yaml_path: str = "GPT_SoVITS/configs/tts_infer.yaml"): try: - tts_instance = get_tts_instance(tts_infer_yaml_path) + tts_config = TTS_Config(tts_infer_yaml_path) + tts_instance = get_tts_instance(tts_config) tts_instance.set_ref_audio(refer_audio_path) except Exception as e: return JSONResponse(status_code=400, content={"message": f"set refer audio failed", "Exception": str(e)}) @@ -434,7 +435,8 @@ async def set_gpt_weights(weights_path: str = None, tts_infer_yaml_path: str = " if weights_path in ["", None]: return JSONResponse(status_code=400, content={"message": "gpt weight path is required"}) - tts_instance = get_tts_instance(tts_infer_yaml_path) + tts_config = TTS_Config(tts_infer_yaml_path) + tts_instance = get_tts_instance(tts_config) tts_instance.init_t2s_weights(weights_path) except Exception as e: return JSONResponse(status_code=400, content={"message": f"change gpt weight failed", "Exception": str(e)}) @@ -448,7 +450,8 @@ async def set_sovits_weights(weights_path: str = None, tts_infer_yaml_path: str if weights_path in ["", None]: return JSONResponse(status_code=400, content={"message": "sovits weight path is required"}) - tts_instance = get_tts_instance(tts_infer_yaml_path) + tts_config = TTS_Config(tts_infer_yaml_path) + tts_instance = get_tts_instance(tts_config) tts_instance.init_vits_weights(weights_path) except Exception as e: return JSONResponse(status_code=400, content={"message": f"change sovits weight failed", "Exception": str(e)})