Spaces:
Sleeping
Sleeping
Upload app.py
Browse files
app.py
CHANGED
|
@@ -505,14 +505,10 @@ def generate_text_sse():
|
|
| 505 |
accumulated = []
|
| 506 |
for text in streamer:
|
| 507 |
accumulated.append(text)
|
| 508 |
-
yield f"data: {json.dumps({'type': 'token', 'text': text})}
|
| 509 |
-
|
| 510 |
-
"
|
| 511 |
|
| 512 |
full_text = "".join(accumulated)
|
| 513 |
-
yield f"data: {json.dumps({'type': 'final', 'text': full_text, 'total_steps': 1})}
|
| 514 |
-
|
| 515 |
-
"
|
| 516 |
|
| 517 |
return Response(
|
| 518 |
stream(), mimetype='text/event-stream',
|
|
|
|
| 505 |
accumulated = []
|
| 506 |
for text in streamer:
|
| 507 |
accumulated.append(text)
|
| 508 |
+
yield f"data: {json.dumps({'type': 'token', 'text': text})}"
|
|
|
|
|
|
|
| 509 |
|
| 510 |
full_text = "".join(accumulated)
|
| 511 |
+
yield f"data: {json.dumps({'type': 'final', 'text': full_text, 'total_steps': 1})}"
|
|
|
|
|
|
|
| 512 |
|
| 513 |
return Response(
|
| 514 |
stream(), mimetype='text/event-stream',
|