From 137041a824abca51dabefab2275552e28296a06e Mon Sep 17 00:00:00 2001 From: Baize Date: Tue, 4 Apr 2023 16:20:35 +0000 Subject: [PATCH] Improve UI --- app.py | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/app.py b/app.py index 4dadcf1..b08c7e4 100644 --- a/app.py +++ b/app.py @@ -26,7 +26,7 @@ def predict(text, max_length_tokens, max_context_length_tokens,): if text=="": - yield chatbot,history,"Empty Context" + yield chatbot,history,"Empty context." return try: model @@ -36,7 +36,7 @@ def predict(text, inputs = generate_prompt_with_history(text,history,tokenizer,max_length=max_context_length_tokens) if inputs is None: - yield chatbot,history,"Too Long Input" + yield chatbot,history,"Input too long." return else: prompt,inputs=inputs @@ -55,11 +55,11 @@ def predict(text, x = x[:x.index("[|AI|]")].strip() x = x.strip(" ") a, b= [[y[0],convert_to_markdown(y[1])] for y in history]+[[text, convert_to_markdown(x)]],history + [[text,x]] - yield a, b, "Generating……" + yield a, b, "Generating..." if shared_state.interrupted: shared_state.recover() try: - yield a, b, "Stop Success" + yield a, b, "Stop: Success" return except: pass @@ -68,7 +68,7 @@ def predict(text, #print(x) #print("="*80) try: - yield a,b,"Generate Success" + yield a,b,"Generate: Success" except: pass @@ -81,7 +81,7 @@ def retry( max_length_tokens, max_context_length_tokens, ): - logging.info("Retry……") + logging.info("Retry...") if len(history) == 0: yield chatbot, history, f"Empty context" return