From 1cbcf14cffacbcbbcd25e7d38db2cdb71f34ae55 Mon Sep 17 00:00:00 2001 From: mrq Date: Thu, 23 Feb 2023 13:18:51 +0000 Subject: [PATCH] oops --- src/utils.py | 2 +- src/webui.py | 5 +++++ 2 files changed, 6 insertions(+), 1 deletion(-) diff --git a/src/utils.py b/src/utils.py index fa5a242..0582e65 100755 --- a/src/utils.py +++ b/src/utils.py @@ -222,7 +222,7 @@ def generate( for line, cut_text in enumerate(texts): if emotion == "Custom": - if prompt.strip() != "": + if prompt and prompt.strip() != "": cut_text = f"[{prompt},] {cut_text}" else: cut_text = f"[I am really {emotion.lower()},] {cut_text}" diff --git a/src/webui.py b/src/webui.py index cc52cf2..3ebae01 100755 --- a/src/webui.py +++ b/src/webui.py @@ -45,6 +45,11 @@ def run_generation( experimental_checkboxes, progress=gr.Progress(track_tqdm=True) ): + if not text: + raise gr.Error("Please provide text.") + if not voice: + raise gr.Error("Please provide a voice.") + try: sample, outputs, stats = generate( text=text,