diff --git a/app.py b/app.py index fb28618..d46de08 100644 --- a/app.py +++ b/app.py @@ -26,14 +26,17 @@ def predict(text, max_length_tokens, max_context_length_tokens,): if text=="": - return history,history,"Empty Context" + yield chatbot,history,"Empty Context" + return try: model except: - return [[text,"No Model Found"]],[],"No Model Found" + yield [[text,"No Model Found"]],[],"No Model Found" + return inputs = generate_prompt_with_history(text,history,tokenizer,max_length=max_context_length_tokens) if inputs is False: - return [[x[0],convert_to_markdown(x[1])] for x in history]+[[text,"Sorry, the input is too long."]],history,"Generate Fail" + yield chatbot+[[text,"Sorry, the input is too long."]],history,"Generate Fail" + return else: prompt,inputs=inputs begin_length = len(prompt)