drewvid commited on
Commit
59e3965
·
1 Parent(s): d28b424

error handling

Browse files
Files changed (1) hide show
  1. app.py +7 -5
app.py CHANGED
@@ -65,11 +65,13 @@ def respond(
65
  temperature=temperature,
66
  top_p=top_p,
67
  ):
68
- token = message.choices[0].delta.content
69
-
70
- if token:
71
- response += token
72
- yield response
 
 
73
 
74
  """
75
  For information on how to customize the ChatInterface, peruse the gradio docs: https://www.gradio.app/docs/chatinterface
 
65
  temperature=temperature,
66
  top_p=top_p,
67
  ):
68
+ if message.choices:
69
+ token = message.choices[0].delta.content
70
+ if token:
71
+ response += token
72
+ yield response
73
+ else:
74
+ yield "Please clear the history and try again."
75
 
76
  """
77
  For information on how to customize the ChatInterface, peruse the gradio docs: https://www.gradio.app/docs/chatinterface