Commit
·
0dd809a
1
Parent(s):
e880bba
API: add root endpoint with routes overview to avoid 404 at /
Browse files- api/main.py +18 -0
api/main.py
CHANGED
|
@@ -49,6 +49,24 @@ class InpaintRequest(BaseModel):
|
|
| 49 |
mask_id: str
|
| 50 |
|
| 51 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 52 |
@app.get("/health")
|
| 53 |
def health() -> Dict[str, str]:
|
| 54 |
return {"status": "healthy"}
|
|
|
|
| 49 |
mask_id: str
|
| 50 |
|
| 51 |
|
| 52 |
+
@app.get("/")
|
| 53 |
+
def root() -> Dict[str, object]:
|
| 54 |
+
return {
|
| 55 |
+
"name": "Photo Object Removal API",
|
| 56 |
+
"status": "ok",
|
| 57 |
+
"endpoints": {
|
| 58 |
+
"GET /health": "health check",
|
| 59 |
+
"POST /upload-image": "form-data: image=file",
|
| 60 |
+
"POST /upload-mask": "form-data: mask=file",
|
| 61 |
+
"POST /inpaint": "JSON: {image_id, mask_id}",
|
| 62 |
+
"POST /inpaint-multipart": "form-data: image=file, mask=file",
|
| 63 |
+
"GET /download/{filename}": "download result image",
|
| 64 |
+
"GET /logs": "recent uploads/results",
|
| 65 |
+
},
|
| 66 |
+
"auth": "set API_TOKEN env var to require Authorization: Bearer <token> (except /health)",
|
| 67 |
+
}
|
| 68 |
+
|
| 69 |
+
|
| 70 |
@app.get("/health")
|
| 71 |
def health() -> Dict[str, str]:
|
| 72 |
return {"status": "healthy"}
|