From a3a6d9d741d3ff9c801a536d51c4f00888d94f7e Mon Sep 17 00:00:00 2001 From: MrPandir Date: Fri, 1 Mar 2024 19:25:55 +0100 Subject: [PATCH] fix: remove hyphens from text to generate --- tts/tts.py | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/tts/tts.py b/tts/tts.py index b270af9..6b17e10 100644 --- a/tts/tts.py +++ b/tts/tts.py @@ -61,6 +61,10 @@ def _load_speakers(self, model: "TTSModelMultiAcc_v3", language: str): def _generate_audio( self, model: "TTSModelMultiAcc_v3", text: str, speaker: str, sample_rate: int ) -> bytes: + # This fixes the problem: + # https://github.com/twirapp/silero-tts-api-server/issues/8 + text = text.replace("-", "").replace("‑", "") + try: audio: torch.Tensor = model.apply_tts(text=text, speaker=speaker, sample_rate=sample_rate) except ValueError: