lenML / ChatTTS-Forge

🍦 ChatTTS-Forge is a project developed around TTS generation model, implementing an API Server and a Gradio-based WebUI.
https://huggingface.co/spaces/lenML/ChatTTS-Forge
GNU Affero General Public License v3.0
692 stars 85 forks source link

API中的google_text_synthesize问题 #43

Closed slmt123 closed 3 months ago

slmt123 commented 3 months ago

您好,当我用google_text_synthesize方法传入ssml时: File "F:\ChatTTS-Forge\modules\api\impl\google_api.py", line 159, in google_text_synthesize sf.write(buffer, audio_data, sample_rate, format="wav") File "C:\Users\Mayn\AppData\Local\Programs\Python\Python310\lib\site-packages\soundfile.py", line 429, in write channels = data.shape[1] IndexError: tuple index out of range ChatGPT的回复是“问题很可能出在传递给soundfile.write()的音频数据的格式和形状上。我们需要确保audio_data的格式是正确的,以便soundfile.write()能够处理它。首先,让我们确保audio_data是一个NumPy数组,并且它的形状适用于soundfile.write()。”

zhzLuke96 commented 3 months ago

使用最新代码重试

要是还有问题请提供详细运行环境详细包括git commit hash

slmt123 commented 3 months ago

刚刚重新clone了一下 commit 5820e576b288df50b929fbdfd9d0d6b6f548b54e (grafted, HEAD -> main, origin/main, origin/HEAD)

通过webui.py启动,设置了API=True webui是正常的,在使用API中的[/v1/text:synthesize]

enhancerConfig中enabled:true的时候 ERROR:root:local variable 'sample_rate' referenced before assignment Traceback (most recent call last): File "F:\ChatTTS-Forge\modules\api\impl\google_api.py", line 179, in google_text_synthesize sr=sample_rate, UnboundLocalError: local variable 'sample_rate' referenced before assignment

enhancerConfig中enabled:false的时候 ERROR:root:local variable 'sample_rate' referenced before assignment Traceback (most recent call last): File "F:\ChatTTS-Forge\modules\api\impl\google_api.py", line 191, in google_text_synthesize sr=sample_rate, UnboundLocalError: local variable 'sample_rate' referenced before assignment

zhzLuke96 commented 3 months ago

fixed 1566f8891c22d63681d756deba70374e2b75d078