Fix `server.py` for multi-speaker models

This commit is contained in:
Eren Gölge 2021-07-26 14:52:32 +02:00
parent 75b201c6c1
commit 764f684e1b
1 changed files with 3 additions and 2 deletions

View File

@ -103,7 +103,8 @@ synthesizer = Synthesizer(
model_path, config_path, speakers_file_path, vocoder_path, vocoder_config_path, use_cuda=args.use_cuda
)
use_multi_speaker = synthesizer.speaker_manager is not None
use_multi_speaker = synthesizer.tts_model.speaker_manager is not None and synthesizer.tts_model.num_speakers > 1
speaker_manager = synthesizer.tts_model.speaker_manager if hasattr(synthesizer.tts_model, "speaker_manager") else None
# TODO: set this from SpeakerManager
use_gst = synthesizer.tts_config.get("use_gst", False)
app = Flask(__name__)
@ -134,7 +135,7 @@ def index():
"index.html",
show_details=args.show_details,
use_multi_speaker=use_multi_speaker,
speaker_ids=synthesizer.speaker_manager.speaker_ids if synthesizer.speaker_manager else None,
speaker_ids=speaker_manager.speaker_ids if speaker_manager is not None else None,
use_gst=use_gst,
)