Spaces:
Sleeping
Sleeping
Commit ·
a4eb928
1
Parent(s): aa0ae43
Update app.py
Browse files
app.py
CHANGED
|
@@ -86,9 +86,10 @@ def chat(message,
|
|
| 86 |
json_obj = json.loads(json_line)
|
| 87 |
if 'token' in json_obj:
|
| 88 |
partial_message = partial_message + json_obj['token']['text']
|
| 89 |
-
|
| 90 |
elif 'error' in json_obj:
|
| 91 |
-
|
|
|
|
| 92 |
else:
|
| 93 |
gr.Warning(f"The key 'token' does not exist in this JSON object: {json_obj}")
|
| 94 |
|
|
|
|
| 86 |
json_obj = json.loads(json_line)
|
| 87 |
if 'token' in json_obj:
|
| 88 |
partial_message = partial_message + json_obj['token']['text']
|
| 89 |
+
return partial_message #yield
|
| 90 |
elif 'error' in json_obj:
|
| 91 |
+
return json_obj['error'] + '. Please refresh and try again with an appropriate smaller input prompt.'
|
| 92 |
+
# yield
|
| 93 |
else:
|
| 94 |
gr.Warning(f"The key 'token' does not exist in this JSON object: {json_obj}")
|
| 95 |
|