Update README.md
Browse files
README.md
CHANGED
|
@@ -7,38 +7,4 @@ sdk: docker
|
|
| 7 |
pinned: false
|
| 8 |
license: mit
|
| 9 |
hardware: cpu-basic
|
| 10 |
-
---
|
| 11 |
-
|
| 12 |
-
Check out the configuration reference at https://huggingface.co/docs/hub/spaces-config-reference
|
| 13 |
-
|
| 14 |
-
## Inpainting API (FastAPI)
|
| 15 |
-
- Auth: optional Bearer via env `API_TOKEN`. If set, send `Authorization: Bearer <token>`.
|
| 16 |
-
|
| 17 |
-
Endpoints:
|
| 18 |
-
- `GET /health` → {"status":"healthy"}
|
| 19 |
-
- `POST /upload-image` (form-data: image=file) → {"id":"<image_id>","filename":"name.png"}
|
| 20 |
-
- `POST /upload-mask` (form-data: mask=file) → {"id":"<mask_id>","filename":"mask.png"}
|
| 21 |
-
- `POST /inpaint` (JSON: {image_id, mask_id}) → {"result":"output_xxx.png"}
|
| 22 |
-
- `POST /inpaint-url` (JSON: {image_id, mask_id}) → {"result":"output_xxx.png","url":"https://.../download/output_xxx.png"}
|
| 23 |
-
- `POST /inpaint-multipart` (form-data: image=file, mask=file) → {"result":"output_xxx.png"}
|
| 24 |
-
- `GET /download/{filename}` → image file (public; optional for ID-based inpaint)
|
| 25 |
-
- `GET /result/{filename}` → view result image in browser (public)
|
| 26 |
-
- `GET /logs` → recent uploads/results
|
| 27 |
-
|
| 28 |
-
Note:
|
| 29 |
-
- `POST /inpaint` returns simple JSON with just the filename.
|
| 30 |
-
- `POST /inpaint-url` returns JSON with filename and shareable URL.
|
| 31 |
-
- Use `/download/{filename}` or `/result/{filename}` to access the result image.
|
| 32 |
-
- You can optionally pass a `prompt` string with `/inpaint`, `/inpaint-url`, or `/inpaint-multipart` to describe what should be removed; the mask still controls the exact region.
|
| 33 |
-
|
| 34 |
-
## Remote inference (Gemini / Imagen edit)
|
| 35 |
-
- Local processing is limited to mask prep and file IO; the heavy lifting is done via Google Gemini/Imagen edit API (CPU-only container is fine).
|
| 36 |
-
- Required env: `GEMINI_API_KEY` (or `GOOGLE_API_KEY` / `GOOGLE_GENAI_API_KEY`).
|
| 37 |
-
- Optional env:
|
| 38 |
-
- `GEMINI_IMAGE_EDIT_MODEL` to override the model id (default: `imagen-3.0-edit-001`).
|
| 39 |
-
- `GEMINI_IMAGE_EDIT_PROMPT` to override the default prompt: "Remove the objects marked by the provided mask and fill the background naturally."
|
| 40 |
-
- Uploaded images/masks are stored in MongoDB GridFS in the `object_remover` database (`MONGO_URI`/`MONGODB_URI` env); IDs returned by `/upload-image` and `/upload-mask` are fetched back from GridFS before calling Gemini.
|
| 41 |
-
|
| 42 |
-
## Local run
|
| 43 |
-
- Install deps: `python3 -m pip install -r requirements.txt`
|
| 44 |
-
- Run API: `python3 -m uvicorn api.main:app --host 0.0.0.0 --port 7860`
|
|
|
|
| 7 |
pinned: false
|
| 8 |
license: mit
|
| 9 |
hardware: cpu-basic
|
| 10 |
+
---
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|