Spaces:
Paused
Paused
dharmendra
commited on
Commit
·
9f54674
1
Parent(s):
44f89b9
Implement streaming responses for LLM API
Browse files
app.py
CHANGED
@@ -75,7 +75,7 @@ async def generate_text(request: QuestionRequest):
|
|
75 |
# For more robust streaming, consider Server-Sent Events (SSE) format:
|
76 |
# yield f"data: {json.dumps({'token': chunk.content})}\n\n"
|
77 |
# For simplicity, we'll just yield the content directly for now.
|
78 |
-
yield chunk
|
79 |
await asyncio.sleep(0.01) # Small delay to allow client to process chunks
|
80 |
|
81 |
except Exception as e:
|
|
|
75 |
# For more robust streaming, consider Server-Sent Events (SSE) format:
|
76 |
# yield f"data: {json.dumps({'token': chunk.content})}\n\n"
|
77 |
# For simplicity, we'll just yield the content directly for now.
|
78 |
+
yield chunk['content']
|
79 |
await asyncio.sleep(0.01) # Small delay to allow client to process chunks
|
80 |
|
81 |
except Exception as e:
|