From ae5d4023aa5a3faaad514dcab4692ef608b0e20f Mon Sep 17 00:00:00 2001 From: mrq Date: Sun, 19 Feb 2023 06:02:47 +0000 Subject: [PATCH] fix for (I assume) some inconsistency with gradio sometimes-but-not-all-the-time coercing an empty Textbox into an empty string or sometimes None, but I also assume that might be a deserialization issue from JSON (cannot be assed to ask people to screenshot UI or send their ./config/generation.json for analysis, so get this hot monkeyshit patch) --- src/utils.py | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/src/utils.py b/src/utils.py index 7c1bb95..12331be 100755 --- a/src/utils.py +++ b/src/utils.py @@ -226,10 +226,13 @@ def generate( 'cvvp_amount': cvvp_weight, } + if delimiter is None: + delimiter = "" + if delimiter == "\\n": delimiter = "\n" - if delimiter != "" and delimiter in text: + if delimiter and delimiter != "" and delimiter in text: texts = text.split(delimiter) else: texts = split_and_recombine_text(text) @@ -353,7 +356,7 @@ def generate( info = { 'text': text, - 'delimiter': '\\n' if delimiter == "\n" else delimiter, + 'delimiter': '\\n' if delimiter and delimiter == "\n" else delimiter, 'emotion': emotion, 'prompt': prompt, 'voice': voice,