Spaces:
Running
Running
Update app.py
Browse files
app.py
CHANGED
@@ -42,7 +42,11 @@ async def generate_response(prompt: str):
|
|
42 |
if not prompt:
|
43 |
raise HTTPException(status_code=400, detail="Prompt cannot be empty")
|
44 |
|
45 |
-
return
|
|
|
|
|
|
|
|
|
46 |
|
47 |
def get_app():
|
48 |
return app
|
|
|
42 |
if not prompt:
|
43 |
raise HTTPException(status_code=400, detail="Prompt cannot be empty")
|
44 |
|
45 |
+
return StreamingResponse(
|
46 |
+
response_with_token(),
|
47 |
+
media_type="text/event-stream",
|
48 |
+
headers={"X-Token": token} # Optionally include token in headers
|
49 |
+
)
|
50 |
|
51 |
def get_app():
|
52 |
return app
|