Alyafeai commited on
Commit
cf25204
1 Parent(s): 3816473

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +8 -13
app.py CHANGED
@@ -180,21 +180,16 @@ def chat_tab():
180
  with sess.post(
181
  ENDPOINT_URL, headers=HEADERS, data=payload, stream=True
182
  ) as response:
183
- print(response.content)
184
  if response.status_code == 200:
185
  for chunk in response.iter_content(chunk_size=4):
186
- try:
187
- if chunk:
188
- decoded = chunk.decode("utf-8")
189
- print(decoded)
190
- full_output += decoded
191
- if full_output.endswith("User:"):
192
- yield full_output[:-5]
193
- # break
194
- else:
195
- yield full_output
196
- except:
197
- print(chunk)
198
 
199
  with gr.Column():
200
  (
 
180
  with sess.post(
181
  ENDPOINT_URL, headers=HEADERS, data=payload, stream=True
182
  ) as response:
 
183
  if response.status_code == 200:
184
  for chunk in response.iter_content(chunk_size=4):
185
+ if chunk:
186
+ decoded = chunk.decode("utf-8")
187
+ full_output += decoded
188
+ if full_output.endswith("User:"):
189
+ yield full_output[:-5]
190
+ break
191
+ else:
192
+ yield full_output
 
 
 
 
193
 
194
  with gr.Column():
195
  (