From a2c67262c7e88933ebe25943d8ff3bc0ec731102 Mon Sep 17 00:00:00 2001 From: oobabooga <112222186+oobabooga@users.noreply.github.com> Date: Thu, 24 Aug 2023 17:27:12 -0700 Subject: [PATCH] Unescape model output for silero/elevenlabs --- extensions/elevenlabs_tts/script.py | 3 ++- extensions/silero_tts/script.py | 3 ++- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/extensions/elevenlabs_tts/script.py b/extensions/elevenlabs_tts/script.py index 2324d782..68ae16bd 100644 --- a/extensions/elevenlabs_tts/script.py +++ b/extensions/elevenlabs_tts/script.py @@ -1,3 +1,4 @@ +import html import re from pathlib import Path @@ -111,7 +112,7 @@ def output_modifier(string): output_file = Path(f'extensions/elevenlabs_tts/outputs/{wav_idx:06d}.mp3'.format(wav_idx)) print(f'Outputting audio to {str(output_file)}') try: - audio = elevenlabs.generate(text=string, voice=params['selected_voice'], model=params['model']) + audio = elevenlabs.generate(text=html.unescape(string), voice=params['selected_voice'], model=params['model']) elevenlabs.save(audio, str(output_file)) autoplay = 'autoplay' if params['autoplay'] else '' diff --git a/extensions/silero_tts/script.py b/extensions/silero_tts/script.py index 707d919b..e7616918 100644 --- a/extensions/silero_tts/script.py +++ b/extensions/silero_tts/script.py @@ -1,3 +1,4 @@ +import html import random import time from pathlib import Path @@ -125,7 +126,7 @@ def output_modifier(string, state): else: output_file = Path(f'extensions/silero_tts/outputs/{state["character_menu"]}_{int(time.time())}.wav') prosody = ''.format(params['voice_speed'], params['voice_pitch']) - silero_input = f'{prosody}{xmlesc(string)}' + silero_input = f'{prosody}{xmlesc(html.unescape(string))}' model.save_wav(ssml_text=silero_input, speaker=params['speaker'], sample_rate=int(params['sample_rate']), audio_path=str(output_file)) autoplay = 'autoplay' if params['autoplay'] else ''