Spaces:
Runtime error
Runtime error
Update app.py
Browse files
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 |
-
|
187 |
-
|
188 |
-
|
189 |
-
|
190 |
-
full_output
|
191 |
-
|
192 |
-
|
193 |
-
|
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 |
(
|