Update app.py
Browse files12345678910111213146 unmodified lines21222324from fastapi import FastAPI, File, UploadFilefrom fastapi.responses import FileResponseimport osimport shutilapp = FastAPI()# Directory to store uploaded filesUPLOAD_DIR = "/app/uploads"os.makedirs(UPLOAD_DIR, exist_ok=True)@app.post("/upload/")async def upload_file(file: UploadFile = File(...)):file_path = os.path.join(UPLOAD_DIR, file.filename)6 unmodified linesfile_path = os.path.join(UPLOAD_DIR, filename)if os.path.exists(file_path):return FileResponse(file_path, media_type='application/octet-stream', filename=filename)return {"error": "File not found"}123456789106 unmodified lines17181920from fastapi import FastAPIfrom fastapi.middleware.gzip import GZipMiddlewareapp = FastAPI()app.add_middleware(GZipMiddleware, minimum_size=1000)# Your existing routes@app.post("/upload/")async def upload_file(file: UploadFile = File(...)):file_path = os.path.join(UPLOAD_DIR, file.filename)6 unmodified linesfile_path = os.path.join(UPLOAD_DIR, filename)if os.path.exists(file_path):return FileResponse(file_path, media_type='application/octet-stream', filename=filename)return {"error": "File not found"}
app.py+5-9