Update app.py
Browse files
app.py
CHANGED
|
@@ -38,10 +38,13 @@ def home(request: Request):
|
|
| 38 |
async def upload(file: UploadFile = File(...)):
|
| 39 |
try:
|
| 40 |
dest = UPLOAD_DIR / f"{uuid.uuid4()}_{file.filename}"
|
|
|
|
| 41 |
with dest.open("wb") as out:
|
| 42 |
-
out.write(
|
| 43 |
-
|
| 44 |
-
|
|
|
|
|
|
|
| 45 |
except Exception as e:
|
| 46 |
raise HTTPException(500, f"Failed to store or push file: {e}")
|
| 47 |
|
|
|
|
| 38 |
async def upload(file: UploadFile = File(...)):
|
| 39 |
try:
|
| 40 |
dest = UPLOAD_DIR / f"{uuid.uuid4()}_{file.filename}"
|
| 41 |
+
content = await file.read()
|
| 42 |
with dest.open("wb") as out:
|
| 43 |
+
out.write(content)
|
| 44 |
+
|
| 45 |
+
# push in separate thread
|
| 46 |
+
await asyncio.to_thread(scheduler.trigger)
|
| 47 |
+
|
| 48 |
except Exception as e:
|
| 49 |
raise HTTPException(500, f"Failed to store or push file: {e}")
|
| 50 |
|