Improve UI

This commit is contained in:
Baize 2023-04-04 16:20:35 +00:00 committed by huggingface-web
parent e0ec530bf4
commit 137041a824
1 changed files with 6 additions and 6 deletions

12
app.py
View File

@ -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