drewvid commited on
Commit
4951d1c
·
1 Parent(s): ca7d5df

error handling

Browse files
Files changed (1) hide show
  1. app.py +7 -5
app.py CHANGED
@@ -56,11 +56,13 @@ def respond(
56
  temperature=temperature,
57
  top_p=top_p,
58
  ):
59
- token = message.choices[0].delta.content
60
-
61
- if token:
62
- response += token
63
- yield response
 
 
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