I wanted a safe and private way to see how clothes will fit with my existing wardrobe before buying them online, so I quickly put this together to run on my 3090.
Virtual try-on functionality powered by IDM-VTON.
- Async job queue for GPU inference
- Prometheus metrics and OpenTelemetry tracing
- Kubernetes-ready health probes
- Request correlation IDs
- Structured JSON logging
- NixOS module and Docker deployment
- NVIDIA GPU with CUDA support
- ~12GB VRAM (float16) or ~24GB VRAM (float32)
- Python 3.11+ or Nix/Docker
# Standard (requires nvidia-container-runtime)
docker run --gpus all -p 8000:8000 ghcr.io/clairesrc/myfit:latest
# NixOS (uses CDI)
docker run --device nvidia.com/gpu=all -p 8000:8000 ghcr.io/clairesrc/myfit:latestnix develop # Enter dev shell
python -m myfit.api.main --host 0.0.0.0pip install -e ".[all]"
python -m myfit.api.mainThe API is available at http://localhost:8000 with docs at /docs.
curl -X POST http://localhost:8000/tryon \
-F "person_image=@person.jpg" \
-F "garment_image=@garment.jpg" \
-F "seed=42"Returns {"job_id": "...", "status": "pending"}.
curl http://localhost:8000/tryon/{job_id}Status: pending → processing → completed | failed
curl -o result.png http://localhost:8000/result/{job_id}| Endpoint | Purpose |
|---|---|
GET /health |
Comprehensive status with GPU/disk info |
GET /health/ready |
Readiness probe (models loaded?) |
GET /health/live |
Liveness probe (process alive?) |
GET /metrics |
Prometheus metrics |
All settings use the MYFIT_ prefix:
| Variable | Default | Description |
|---|---|---|
MYFIT_HOST |
127.0.0.1 |
Bind address |
MYFIT_PORT |
8000 |
Server port |
MYFIT_DEVICE |
cuda |
cuda or cpu |
MYFIT_PRECISION |
float16 |
float16 or float32 |
MYFIT_RESULT_PATH |
/tmp/myfit-results |
Result storage |
MYFIT_LOG_LEVEL |
INFO |
DEBUG, INFO, WARNING, ERROR |
MYFIT_LOG_FORMAT |
text |
text or json |
MYFIT_METRICS_ENABLED |
true |
Enable /metrics endpoint |
MYFIT_TRACING_ENABLED |
false |
Enable OpenTelemetry |
MYFIT_OTLP_ENDPOINT |
— | OTLP exporter endpoint |
MYFIT_FRONTEND_ENABLED |
true |
Enable web UI |
kubectl apply -f k8s/Includes Deployment with GPU resources, readiness/liveness probes, ConfigMap, Service, and Ingress.
{
inputs.myfit.url = "github:clairesrc/myfit";
outputs = { self, nixpkgs, myfit, ... }: {
nixosConfigurations.host = nixpkgs.lib.nixosSystem {
modules = [
myfit.nixosModules.default
{
services.myfit = {
enable = true;
host = "0.0.0.0";
openFirewall = true;
};
}
];
};
};
}nix develop # Enter dev shell
pytest tests/ -v # Run tests
ruff check myfit/ # Lint
mypy myfit/ # Type check
pre-commit install # Setup git hooksGitHub Actions runs on every push:
- Lint: ruff check + format
- Type check: mypy
- Test: pytest with coverage
- Security: Trivy vulnerability scan
- Build: Docker image to GHCR (main branch)
MIT. The IDM-VTON model weights are licensed under CC BY-NC-SA 4.0 and are downloaded separately at runtime.