Description
Describe the bug
@app.route("/api/tts", methods=["GET", "POST"])
def tts():
with lock:
text = request.headers.get("text") or request.values.get("text", "")
speaker_idx = request.headers.get("speaker-id") or request.values.get("speaker_id", "")
language_idx = request.headers.get("language-id") or request.values.get("language_id", "")
style_wav = request.headers.get("style-wav") or request.values.get("style_wav", "")
style_wav = style_wav_uri_to_dict(style_wav)
print(f" > Model input: {text}")
print(f" > Speaker Idx: {speaker_idx}")
print(f" > Language Idx: {language_idx}")
wavs = synthesizer.tts(text, speaker_name=speaker_idx, language_name=language_idx, style_wav=style_wav)
out = io.BytesIO()
synthesizer.save_wav(wavs, out)
return send_file(out, mimetype="audio/wav")
or
device = "cpu"
tts = TTS("tts_models/multilingual/multi-dataset/xtts_v2").to(device)
tts.tts_to_file(text=text,
file_path="output.wav",
speaker_wav=style_wav,
language="en")
ERROR:xtts_server_xc:Exception on /api/tts [POST]
Traceback (most recent call last):
File "/usr/local/lib/python3.10/site-packages/flask/app.py", line 1455, in wsgi_app
response = self.full_dispatch_request()
File "/usr/local/lib/python3.10/site-packages/flask/app.py", line 869, in full_dispatch_request
rv = self.handle_user_exception(e)
File "/usr/local/lib/python3.10/site-packages/flask/app.py", line 867, in full_dispatch_request
rv = self.dispatch_request()
File "/usr/local/lib/python3.10/site-packages/flask/app.py", line 852, in dispatch_request
return self.ensure_sync(self.view_functions[rule.endpoint])(**view_args)
File "/root/TTS/server/xtts_server_xc.py", line 209, in tts
wavs = synthesizer.tts(text, speaker_name=speaker_idx, language_name=language_idx, style_wav=style_wav)
File "/root/TTS/utils/synthesizer.py", line 386, in tts
outputs = self.tts_model.synthesize(
File "/root/TTS/tts/models/xtts.py", line 411, in synthesize
gpt_cond_latent, speaker_embedding = self.speaker_manager.speakers[speaker_id].values()
KeyError: 'default_speaker'
Both with and without the speaker parameter will result in an error, and the problem lies with the speaker.
May I ask, what is the value of the speaker parameter?
To Reproduce
Both with and without the speaker parameter will result in an error, and the problem lies with the speaker.
May I ask, what is the value of the speaker parameter?
Expected behavior
No response
Logs
Environment
docker
Additional context
No response