Spaces:
Running
Running
Update main.py
Browse files
main.py
CHANGED
|
@@ -75,13 +75,18 @@ async def root(item: Item):
|
|
| 75 |
}):
|
| 76 |
# Yield the event as a string
|
| 77 |
yield str(event)
|
|
|
|
| 78 |
|
| 79 |
# Use StreamingResponse to stream the events
|
| 80 |
-
return StreamingResponse(event_generator())
|
| 81 |
|
| 82 |
except requests.RequestException as e:
|
| 83 |
return {"error": str(e), "status_code": 500}
|
| 84 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
| 85 |
@app.post("/extract-content")
|
| 86 |
async def root(item: Item):
|
| 87 |
|
|
|
|
| 75 |
}):
|
| 76 |
# Yield the event as a string
|
| 77 |
yield str(event)
|
| 78 |
+
print(str(event), end="")
|
| 79 |
|
| 80 |
# Use StreamingResponse to stream the events
|
| 81 |
+
return StreamingResponse(event_generator(), media_type='text/event-stream')
|
| 82 |
|
| 83 |
except requests.RequestException as e:
|
| 84 |
return {"error": str(e), "status_code": 500}
|
| 85 |
+
|
| 86 |
+
|
| 87 |
+
|
| 88 |
+
|
| 89 |
+
|
| 90 |
@app.post("/extract-content")
|
| 91 |
async def root(item: Item):
|
| 92 |
|