Implement FastAPI backend and /api/clean endpoint in app.py #3
Labels
No labels
needs-info
needs-triage
ready-for-agent
ready-for-human
wayfinder:grilling
wayfinder:map
wayfinder:prototype
wayfinder:research
wayfinder:task
wontfix
No milestone
No project
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set.
Reference: tilltheend/unwrap-clothes#3
Loading…
Add table
Reference in a new issue
No description provided.
Delete branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Parent
Parent Map: #1 (Garment Photo Cleaner Web App [Map])
Blocked by
Blocked by: "Decouple core photo cleaning logic for CLI and API reuse"
Question
What is the exact interface and behavior of the
POST /api/cleanendpoint inapp.py(supporting multipart image upload, prompt, optional model, optional API key override), and how does it serve static assets and stream/return base64 or binary cleaned image data with cost/resolution metadata?Resolution
Implemented the FastAPI backend and
/api/cleanendpoint inapp.py.Architectural decisions and API interface
POST /api/cleanacceptsmultipart/form-datawith:file: UploadFile(required): uploaded garment image.prompt: str(optional): custom prompt or preset description. Defaults to beige preset.model: str(optional): OpenRouter model slug, defaults tometa/muse-image.api_key: str | None(optional): API key override, falling back toOPENROUTER_API_KEYin environment.restore_res: bool(optional, default True): toggles Lanczos upscaling back to source photo dimensions.image: Base64 data URI (data:<mime>;base64,...) for instant rendering and download without extra roundtrips.cost: Billed OpenRouter generation cost (float or null).widthandheight: Final dimensions of the delivered image.original_dimensionsandmodel_dimensions: Tuple arrays[w, h]for diagnostics and UI comparison.was_rescaled: Boolean flag indicating whether Lanczos restoration ran.media_type: MIME type of the returned image.static/index.htmlat root/with fallback status payload when static files are not yet created, and mounts/staticfor assets.python3 app.pylaunches Uvicorn onhttp://127.0.0.1:8000.fastapi,uvicorn, andpython-multipartadded torequirements.txt.