Note: This repository directory may be named
clothless-nextlocally; the Python package and CLI areoutfit-studio(outfit_studio/).
AI outfit inpainting for photos. Upload a person image, segment the person and clothing, optionally edit the masks, then inpaint a new outfit with Stable Diffusion.
The README demo assets are synthetic, fully clothed, and non-explicit. They show the
vanilla repository path using runwayml/stable-diffusion-inpainting with ControlNet
disabled.
- Serves a Gradio UI with login, credits, examples, history, and an ImageEditor mask workflow.
- Uses the FASHN Human Parser (SegFormer B4) to build person and clothing masks automatically.
- Lets users repaint masks before generation, so the model changes only intended clothing regions.
- Runs Diffusers inpainting with SD1.5, SDXL, or local
.safetensors/.ckptcheckpoints. - Optionally adds OpenPose ControlNet guidance for SD1.5 checkpoints.
- Saves pipeline debug artifacts for masks, crops, inpaint inputs, diffusion output, blending, metadata, and final results.
This walkthrough was produced from a fresh non-NSFW synthetic source image, then passed through the real pipeline with:
- model:
runwayml/stable-diffusion-inpainting - ControlNet: off
- seed:
4242 - steps:
24 - prompt target: a modest, fully clothed editorial outfit
The green overlay marks clothing pixels selected for inpainting; the red overlay marks the detected person area used for instance splitting and blending. Vanilla SD1.5 changes the outfit region cleanly, while custom checkpoints and ControlNet can improve style faithfulness for production use.
Useful demo files:
| File | Purpose |
|---|---|
docs/assets/demo-source.png |
Synthetic, fully clothed input image |
docs/assets/demo-mask-overlay.png |
Person and clothing masks from segmentation |
docs/assets/demo-inpaint-input.png |
Crop prepared for inpainting |
docs/assets/demo-diffusion-output.png |
Raw vanilla SD1.5 inpaint result |
docs/assets/demo-blended-crop.png |
Feathered crop before full-frame compositing |
docs/assets/demo-result-vanilla-sd15.png |
Final feathered full-frame blend |
Add these lines to .env when you want inspectable intermediates for a run:
OUTFIT_STUDIO_PIPELINE_DEBUG=true
OUTFIT_STUDIO_PIPELINE_DEBUG_DIR=debug-pipelineEach run creates a timestamped folder. The segmentation phase records source and fused masks; the generation phase records the final masks, per-person crop, inpaint input, diffusion output, blended crop, full composite, and JSON metadata.
- Python 3.10-3.12
- uv
- NVIDIA GPU recommended
- 8 GB+ VRAM recommended for SD1.5 inpainting
cp .env.example .env
make install-fast
make runOpen http://localhost:7860.
Default login:
admin / admin
make install-fast creates the virtual environment from the pinned lockfile,
installs dependencies (including CUDA PyTorch and ONNX Runtime GPU support), and
downloads the configured segmentation and inpaint models.
powershell -ExecutionPolicy RemoteSigned -File scripts\setup.ps1
.\.venv\Scripts\Activate.ps1
.\.venv\Scripts\python.exe -m outfit_studio.mainReinstall CUDA torch / ORT after uv sync: scripts\install-cuda.ps1.
If the console mangles box-drawing glyphs, set OUTFIT_STUDIO_ASCII_LOG=true.
Run make (or make help) for the colored target list. NO_COLOR=1 disables ANSI.
| Target | Description |
|---|---|
make / make help |
Show targets |
make install |
Create .venv and install pinned Python dependencies |
make install-fast |
Install deps from uv.lock and download models |
make download-models |
Download segmentation weights and configured inpaint checkpoint |
make run |
Start the Gradio UI |
make stop |
Stop the local Gradio demo (make run) |
make test |
Run non-slow unit tests |
make lint |
Run Ruff |
make docker-build |
Build the Docker image |
make docker-up |
Start with GPU support |
make docker-up-cpu |
Start without GPU (base compose only) |
make docker-download-models |
Download ML weights into the running container |
make docker-down |
Stop containers |
make docker-logs |
Follow container logs |
Requires Docker and, for GPU inference, the NVIDIA Container Toolkit.
cp .env.example .env
make docker-build
make docker-up # GPU (compose + docker-compose.gpu.yml)
make docker-up-cpu # CPU-only, no NVIDIA Container Toolkit
make docker-download-models # if not bind-mounting local weightsOpen http://localhost:7860. Default login (bootstrapped on first start):
admin / admin1234
Checkpoints bind-mount from ./models by default. Optional .env overrides:
OUTFIT_STUDIO_HOST_MODELS_DIR— host checkpoint path (use the real path if./modelsis a symlink)OUTFIT_STUDIO_HOST_HF_CACHE— Hugging Face hub cache (default:~/.cache/huggingface)
Deployment settings live in .env: host, port, paths, auth, credits, logging, and
pipeline debug flags.
| Setting | Purpose |
|---|---|
OUTFIT_STUDIO_HOST / OUTFIT_STUDIO_PORT |
Server bind address |
OUTFIT_STUDIO_MODELS_DIR |
Local model/checkpoint directory |
OUTFIT_STUDIO_OUTPUT_DIR |
Generated image output directory |
OUTFIT_STUDIO_DB_PATH |
SQLite database path |
OUTFIT_STUDIO_REQUIRE_AUTH |
Login requirement |
OUTFIT_STUDIO_DEFAULT_* |
Default admin and credit settings |
OUTFIT_STUDIO_DEBUG / OUTFIT_STUDIO_LOG_LEVEL |
Diagnostics |
OUTFIT_STUDIO_PIPELINE_DEBUG* |
Intermediate artifact dumps |
OUTFIT_STUDIO_TENSOR_TORRENT |
Enable TT size-gate path (default true) |
OUTFIT_STUDIO_TENSOR_TORRENT_MIN_PARAMS_GB |
Skip TT below this param GiB (default 4.0) |
OUTFIT_STUDIO_TENSOR_TORRENT_UNET |
Allow UNet TT when size gate passes (default true) |
OUTFIT_STUDIO_TENSOR_TORRENT_CACHE_DIR |
TT artifact cache (default .cache/tensortorrent) |
OUTFIT_STUDIO_CIVITAI_API_TOKEN |
Bearer token for Civitai checkpoint downloads |
Models, prompts, and generation defaults are intentionally not stored in .env.
Branding, prompts, checkpoints, and generation tuning live in config/.
| File | Tracked | Purpose |
|---|---|---|
config/content.default.yaml |
Yes | Vanilla defaults shipped with the repo |
config/content.local.yaml |
No | Local overrides for prompts, models, URLs, and generation tuning |
config/content.local.yaml.example |
Yes | Template for local overrides |
cp config/content.local.yaml.example config/content.local.yamlThe local YAML file is merged on top of the default file. The shipped default inpaint
checkpoint is runwayml/stable-diffusion-inpainting; the local example can point at
custom .safetensors checkpoints and download URLs.
| Component | Technology |
|---|---|
| UI | Gradio 4 + ImageSlider |
| Segmentation | FASHN Human Parser (SegFormer B4) |
| Pose, optional | rtmlib ONNX + ControlNet OpenPose |
| Inpainting | Diffusers SD1.5 / SDXL inpaint |
| Oversized models | TensorTorrent when params ≥ MIN_PARAMS_GB (else torch.compile) |
| Auth/history | SQLite + Argon2 |
When OUTFIT_STUDIO_TENSOR_TORRENT=true (default), Outfit Studio only hands a module
to TensorTorrent if its parameters are at least
OUTFIT_STUDIO_TENSOR_TORRENT_MIN_PARAMS_GB (default 4.0 GiB). SD1.5 inpaint
UNets (~1.7 GiB bf16) and the human parser stay on eager / torch.compile —
TT's compile + schedule tax made them slower, and a resident LATENCY plan OOMs
next to ControlNet on 8 GB cards. Oversized UNets (e.g. SDXL ≈4.8 GiB) use TT:
text_embeds / time_ids export as plain tensors; LATENCY first, MEMORY+NVMe
streaming if capacity fails. ControlNet stays eager. Pose ONNX stays outside TT.
Artifacts cache under .cache/tensortorrent/.
make lint
make test
pre-commit install
pre-commit run --all-filesPython entry points:
.venv/bin/outfit-studio-download-models
.venv/bin/outfit-studio

