Spaces:
Running
Running
Update main.py
Browse files- app/main.py +13 -9
app/main.py
CHANGED
@@ -87,15 +87,19 @@ async def process_input(text: str):
|
|
87 |
if text and len(text.strip()) > 0:
|
88 |
text = text.strip()
|
89 |
streaming_response = session_assistant.ask(text)
|
90 |
-
|
91 |
-
|
92 |
-
|
93 |
-
|
94 |
-
|
95 |
-
|
96 |
-
|
97 |
-
|
98 |
-
return StreamingResponse(
|
|
|
|
|
|
|
|
|
99 |
|
100 |
|
101 |
@app.post("/upload")
|
|
|
87 |
if text and len(text.strip()) > 0:
|
88 |
text = text.strip()
|
89 |
streaming_response = session_assistant.ask(text)
|
90 |
+
headers = {
|
91 |
+
'X-Content-Type-Options': 'nosniff',
|
92 |
+
'Content-Type': 'text/event-stream',
|
93 |
+
'Cache-Control': 'no-cache',
|
94 |
+
'Content-Encoding': 'none',
|
95 |
+
'Connection': 'keep-alive',
|
96 |
+
'Access-Control-Allow-Origin': '*'
|
97 |
+
}
|
98 |
+
return StreamingResponse(
|
99 |
+
astreamer(streaming_response.response_gen),
|
100 |
+
headers=headers,
|
101 |
+
media_type='text/event-stream'
|
102 |
+
)
|
103 |
|
104 |
|
105 |
@app.post("/upload")
|