Spaces:
Paused
Paused
Muhammad Usman Nazir commited on
Commit ·
f7df04f
1
Parent(s): f2bced4
fix: optimize file reading in viz2d_job_file by reading entire file at once
Browse files
app.py
CHANGED
|
@@ -1149,8 +1149,8 @@ async def viz2d_job_file(job_id: str):
|
|
| 1149 |
raise HTTPException(status_code=404, detail="Job output not found.")
|
| 1150 |
async def iter_file():
|
| 1151 |
async with aiofiles.open(bundle_path, "rb") as f:
|
| 1152 |
-
|
| 1153 |
-
|
| 1154 |
|
| 1155 |
return StreamingResponse(iter_file(), media_type="application/json")
|
| 1156 |
|
|
|
|
| 1149 |
raise HTTPException(status_code=404, detail="Job output not found.")
|
| 1150 |
async def iter_file():
|
| 1151 |
async with aiofiles.open(bundle_path, "rb") as f:
|
| 1152 |
+
data = await f.read()
|
| 1153 |
+
yield data
|
| 1154 |
|
| 1155 |
return StreamingResponse(iter_file(), media_type="application/json")
|
| 1156 |
|