Spaces:
Runtime error
Runtime error
project-baize
commited on
Commit
•
25a1a26
1
Parent(s):
2736189
Update app.py
Browse files
app.py
CHANGED
@@ -26,14 +26,17 @@ def predict(text,
|
|
26 |
max_length_tokens,
|
27 |
max_context_length_tokens,):
|
28 |
if text=="":
|
29 |
-
|
|
|
30 |
try:
|
31 |
model
|
32 |
except:
|
33 |
-
|
|
|
34 |
inputs = generate_prompt_with_history(text,history,tokenizer,max_length=max_context_length_tokens)
|
35 |
if inputs is False:
|
36 |
-
|
|
|
37 |
else:
|
38 |
prompt,inputs=inputs
|
39 |
begin_length = len(prompt)
|
|
|
26 |
max_length_tokens,
|
27 |
max_context_length_tokens,):
|
28 |
if text=="":
|
29 |
+
yield chatbot,history,"Empty Context"
|
30 |
+
return
|
31 |
try:
|
32 |
model
|
33 |
except:
|
34 |
+
yield [[text,"No Model Found"]],[],"No Model Found"
|
35 |
+
return
|
36 |
inputs = generate_prompt_with_history(text,history,tokenizer,max_length=max_context_length_tokens)
|
37 |
if inputs is False:
|
38 |
+
yield chatbot+[[text,"Sorry, the input is too long."]],history,"Generate Fail"
|
39 |
+
return
|
40 |
else:
|
41 |
prompt,inputs=inputs
|
42 |
begin_length = len(prompt)
|