From c7f85dbba2848e693cfef346fdd0a4eb798e8428 Mon Sep 17 00:00:00 2001 From: mrq Date: Sun, 5 Feb 2023 06:55:09 +0000 Subject: [PATCH] Fix to keep prompted emotion for every split line --- app.py | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/app.py b/app.py index 73300ad..d7447e2 100755 --- a/app.py +++ b/app.py @@ -16,11 +16,6 @@ def generate(text, delimiter, emotion, prompt, voice, mic_audio, preset, seed, c else: voices = [] - if emotion == "Custom" and prompt.strip() != "": - text = f"[{prompt},] {text}" - elif emotion != "None": - text = f"[I am really {emotion.lower()},] {text}" - if voice == "microphone": if mic_audio is None: raise gr.Error("Please provide audio from mic when choosing `microphone` as a voice input") @@ -76,6 +71,11 @@ def generate(text, delimiter, emotion, prompt, voice, mic_audio, preset, seed, c audio_cache = {} for line, cut_text in enumerate(texts): + if emotion == "Custom" and prompt.strip() != "": + cut_text = f"[{prompt},] {cut_text}" + elif emotion != "None": + cut_text = f"[I am really {emotion.lower()},] {cut_text}" + print(f"[{str(line+1)}/{str(len(texts))}] Generating line: {cut_text}") gen, additionals = tts.tts(cut_text, **settings )