RVC-Boss / GPT-SoVITS

1 min voice data can also be used to train a good TTS model! (few shot voice cloning)
MIT License
31.73k stars 3.64k forks source link

大佬您好,直接调用api里面handle推理函数没有生成推理音频,是什么问题 #1150

Open uspear opened 2 months ago

uspear commented 2 months ago

这个是我改写的代码 `

获取prompt配置

def get_prompt_by_id(prompt_id): """

async def tts_endpoint(promptName,text): prompt_config = get_prompt_by_id(promptName) text_language = "en" cut_punc = None return handle(prompt_config['prompt_wav_path'], prompt_config['prompt_text'], prompt_config['prompt_language'], text, text_language, cut_punc)

if name == "main": text = "hello" tts_endpoint("abc",text ) ` 以下是程序运行返回的截图 image

aqpmzngldh commented 2 months ago

这个是我改写的代码 `

获取prompt配置

def get_prompt_by_id(prompt_id): """ - 根据prompt_id获取配置 - 设置克隆音频路径、克隆音频提示文本、克隆音频提示文本的语言 - 模型 """ file_path = r"./prompt/config.json" try: with open(file_path, 'r', encoding='utf-8') as file: data = json.load(file) # 确保数据结构与你的json文件匹配 return data.get(prompt_id, [])

except FileNotFoundError:
    print(f"文件未找到:{file_path}")
    return None
except json.JSONDecodeError:
    print(f"解析JSON错误,请检查{file_path}的格式")
    return None
except Exception as e:
    print(f"发生未知错误:{e}")
    return None

async def tts_endpoint(promptName,text): prompt_config = get_prompt_by_id(promptName) text_language = "en" cut_punc = None return handle(prompt_config['prompt_wav_path'], prompt_config['prompt_text'], prompt_config['prompt_language'], text, text_language, cut_punc)

if name == "main": text = "hello" tts_endpoint("abc",text ) ` 以下是程序运行返回的截图 image

额,这位仁兄,问一下,怎么通过api调用