Spaces:
Sleeping
Sleeping
ypfate
Browse files
app.py
CHANGED
|
@@ -304,19 +304,6 @@ async def generate_excel(predictions: List[Prediction]):
|
|
| 304 |
else:
|
| 305 |
return JSONResponse(status_code=500, content={"error": "File upload failed"})
|
| 306 |
|
| 307 |
-
@app.get("/download-excel/")
|
| 308 |
-
async def download_excel(url: str):
|
| 309 |
-
try:
|
| 310 |
-
# Download the file from File.io using the provided URL
|
| 311 |
-
response = requests.get(url)
|
| 312 |
-
response.raise_for_status() # Check for request errors
|
| 313 |
-
|
| 314 |
-
# Return the file as a streaming response
|
| 315 |
-
return StreamingResponse(BytesIO(response.content), media_type="application/vnd.openxmlformats-officedocument.spreadsheetml.sheet")
|
| 316 |
-
|
| 317 |
-
except requests.exceptions.RequestException as e:
|
| 318 |
-
print(f"Error downloading the file: {e}")
|
| 319 |
-
return {"error": "File download failed"}
|
| 320 |
|
| 321 |
'''
|
| 322 |
@app.post("/generate-excel/")
|
|
|
|
| 304 |
else:
|
| 305 |
return JSONResponse(status_code=500, content={"error": "File upload failed"})
|
| 306 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 307 |
|
| 308 |
'''
|
| 309 |
@app.post("/generate-excel/")
|