Fix silero_tts HTML unescaping

This commit is contained in:
oobabooga 2023-08-26 00:45:07 -07:00
parent db42b365c9
commit 1a642c12b5

View File

@ -119,14 +119,14 @@ def output_modifier(string, state):
return string
original_string = string
string = tts_preprocessor.preprocess(string)
string = tts_preprocessor.preprocess(html.unescape(string))
if string == '':
string = '*Empty reply, try regenerating*'
else:
output_file = Path(f'extensions/silero_tts/outputs/{state["character_menu"]}_{int(time.time())}.wav')
prosody = '<prosody rate="{}" pitch="{}">'.format(params['voice_speed'], params['voice_pitch'])
silero_input = f'<speak>{prosody}{xmlesc(html.unescape(string))}</prosody></speak>'
silero_input = f'<speak>{prosody}{xmlesc(string)}</prosody></speak>'
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 ''