ThomasSimonini HF staff commited on
Commit
a4eb928
1 Parent(s): aa0ae43

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +3 -2
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
- yield partial_message
90
  elif 'error' in json_obj:
91
- yield json_obj['error'] + '. Please refresh and try again with an appropriate smaller input prompt.'
 
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