Commit
·
78b2ce5
1
Parent(s):
70b7f99
chore(api): remove Bearer auth from upload/get-hairswap/download/logs endpoints
Browse files
server.py
CHANGED
|
@@ -116,7 +116,7 @@ os.makedirs(LOGS_DIR, exist_ok=True)
|
|
| 116 |
|
| 117 |
|
| 118 |
@app.post("/upload")
|
| 119 |
-
async def upload_image(image: UploadFile = File(...)
|
| 120 |
if not image.filename:
|
| 121 |
raise HTTPException(status_code=400, detail="No file name provided")
|
| 122 |
contents = await image.read()
|
|
@@ -140,7 +140,7 @@ async def upload_image(image: UploadFile = File(...), _=Depends(verify_bearer)):
|
|
| 140 |
|
| 141 |
|
| 142 |
@app.post("/get-hairswap")
|
| 143 |
-
def get_hairswap(req: HairSwapRequest
|
| 144 |
try:
|
| 145 |
# Resolve file paths
|
| 146 |
def find_file(image_id: str) -> str:
|
|
@@ -216,7 +216,7 @@ def get_hairswap(req: HairSwapRequest, _=Depends(verify_bearer)):
|
|
| 216 |
|
| 217 |
|
| 218 |
@app.get("/download/{filename}")
|
| 219 |
-
def download(filename: str
|
| 220 |
path = os.path.join(RESULTS_DIR, filename)
|
| 221 |
if not os.path.exists(path):
|
| 222 |
raise HTTPException(status_code=404, detail="File not found")
|
|
@@ -224,7 +224,7 @@ def download(filename: str, _=Depends(verify_bearer)):
|
|
| 224 |
|
| 225 |
|
| 226 |
@app.get("/logs")
|
| 227 |
-
def logs(
|
| 228 |
if uploads_col and results_col:
|
| 229 |
uploads = list(uploads_col.find({}, {"_id": 1, "filename": 1}).limit(20))
|
| 230 |
results = list(results_col.find({}, {"_id": 1, "filename": 1, "source_id": 1, "reference_id": 1}).limit(20))
|
|
|
|
| 116 |
|
| 117 |
|
| 118 |
@app.post("/upload")
|
| 119 |
+
async def upload_image(image: UploadFile = File(...)):
|
| 120 |
if not image.filename:
|
| 121 |
raise HTTPException(status_code=400, detail="No file name provided")
|
| 122 |
contents = await image.read()
|
|
|
|
| 140 |
|
| 141 |
|
| 142 |
@app.post("/get-hairswap")
|
| 143 |
+
def get_hairswap(req: HairSwapRequest):
|
| 144 |
try:
|
| 145 |
# Resolve file paths
|
| 146 |
def find_file(image_id: str) -> str:
|
|
|
|
| 216 |
|
| 217 |
|
| 218 |
@app.get("/download/{filename}")
|
| 219 |
+
def download(filename: str):
|
| 220 |
path = os.path.join(RESULTS_DIR, filename)
|
| 221 |
if not os.path.exists(path):
|
| 222 |
raise HTTPException(status_code=404, detail="File not found")
|
|
|
|
| 224 |
|
| 225 |
|
| 226 |
@app.get("/logs")
|
| 227 |
+
def logs():
|
| 228 |
if uploads_col and results_col:
|
| 229 |
uploads = list(uploads_col.find({}, {"_id": 1, "filename": 1}).limit(20))
|
| 230 |
results = list(results_col.find({}, {"_id": 1, "filename": 1, "source_id": 1, "reference_id": 1}).limit(20))
|