Problem
Running image models locally means juggling checkpoints, Python environments, GPU diagnostics, and a usable UI. This project wraps that into one coordinated app.
Frontend work
- React dashboard for generation, gallery, runtime diagnostics, and image-to-image editor
- Canvas-based crop/color preprocessing plus server-side Pillow tool endpoints
- Typed API client for JSON and multipart flows with Vitest component coverage
Backend & system work
- FastAPI routes with subprocess `diffusers` runner in a dedicated model venv
- Generation lock and CUDA OOM retry with smaller preset sizes
- Optional API key, CORS origin checks, and upload validation for local-but-exposed use
- Filesystem output storage under `outputs/generated`
Key decisions
- Isolate GPU inference in a subprocess/venv so the API stays fast and testable
- Allowlisted model IDs instead of arbitrary filesystem paths from the client
- Split instant browser edits from heavier Pillow tools before image-to-image runs
Challenges
- Orchestrating reliable local GPU pipelines across two Python environments and a web UI
- Canvas mask retouch workflow with backend blur/median fill
- Keeping frontend types aligned with Pydantic schemas across JSON and multipart routes
Tech stack
Frontend
- React 19
- TypeScript
- Vite
- Vitest
- Testing Library
Backend
- FastAPI
- Uvicorn
- Pydantic Settings
- Pillow
Data
- Local filesystem
Infrastructure
- PowerShell dev scripts
Testing
- Vitest
- pytest
AI / ML
- Stable Diffusion 1.5
- diffusers
- Realistic Vision checkpoint
Browser APIs
- Canvas
- Fetch
- FormData
Links