Update app.py
This commit is contained in:
parent
1a2243e5f5
commit
8ed0878ea8
5
app.py
5
app.py
|
@ -27,7 +27,10 @@ def predict(text,
|
||||||
max_context_length_tokens,):
|
max_context_length_tokens,):
|
||||||
if text=="":
|
if text=="":
|
||||||
return history,history,"Empty Context"
|
return history,history,"Empty Context"
|
||||||
|
try:
|
||||||
|
model
|
||||||
|
except:
|
||||||
|
return [[text,"No Model Found"]],[],"No Model Found"
|
||||||
inputs = generate_prompt_with_history(text,history,tokenizer,max_length=max_context_length_tokens)
|
inputs = generate_prompt_with_history(text,history,tokenizer,max_length=max_context_length_tokens)
|
||||||
if inputs is False:
|
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"
|
return [[x[0],convert_to_markdown(x[1])] for x in history]+[[text,"Sorry, the input is too long."]],history,"Generate Fail"
|
||||||
|
|
Loading…
Reference in New Issue