error handling
Browse files
app.py
CHANGED
|
@@ -56,11 +56,13 @@ def respond(
|
|
| 56 |
temperature=temperature,
|
| 57 |
top_p=top_p,
|
| 58 |
):
|
| 59 |
-
|
| 60 |
-
|
| 61 |
-
|
| 62 |
-
|
| 63 |
-
|
|
|
|
|
|
|
| 64 |
|
| 65 |
"""
|
| 66 |
For information on how to customize the ChatInterface, peruse the gradio docs: https://www.gradio.app/docs/chatinterface
|
|
|
|
| 56 |
temperature=temperature,
|
| 57 |
top_p=top_p,
|
| 58 |
):
|
| 59 |
+
if message.choices:
|
| 60 |
+
token = message.choices[0].delta.content
|
| 61 |
+
if token:
|
| 62 |
+
response += token
|
| 63 |
+
yield response
|
| 64 |
+
else:
|
| 65 |
+
yield "Please clear the history and try again."
|
| 66 |
|
| 67 |
"""
|
| 68 |
For information on how to customize the ChatInterface, peruse the gradio docs: https://www.gradio.app/docs/chatinterface
|