Spaces:
Running
Running
Hemil Ghori commited on
Commit ·
a003cd4
1
Parent(s): 54f989b
fix build - remove docker + simplify deps
Browse files- Dockerfile +0 -31
- README.md +1 -149
- requirements.txt +9 -76
Dockerfile
DELETED
|
@@ -1,31 +0,0 @@
|
|
| 1 |
-
# Dockerfile for Hugging Face Space with CUDA-enabled PyTorch
|
| 2 |
-
# Uses an official PyTorch CUDA runtime image so torch + CUDA are already installed
|
| 3 |
-
FROM pytorch/pytorch:2.5.1-cuda121-cudnn8-runtime
|
| 4 |
-
|
| 5 |
-
WORKDIR /app
|
| 6 |
-
|
| 7 |
-
# Copy project
|
| 8 |
-
COPY . /app
|
| 9 |
-
|
| 10 |
-
# Install system packages required by the repo and git-lfs
|
| 11 |
-
RUN apt-get update && apt-get install -y \
|
| 12 |
-
git \
|
| 13 |
-
git-lfs \
|
| 14 |
-
ffmpeg \
|
| 15 |
-
libsm6 \
|
| 16 |
-
libxext6 \
|
| 17 |
-
libgl1 \
|
| 18 |
-
&& rm -rf /var/lib/apt/lists/* \
|
| 19 |
-
&& git lfs install
|
| 20 |
-
|
| 21 |
-
# Upgrade pip
|
| 22 |
-
RUN python -m pip install --upgrade pip
|
| 23 |
-
|
| 24 |
-
# Install Python requirements but skip torch/torchvision/torchaudio (provided by base image)
|
| 25 |
-
RUN sed -e '/^torch\b/d' -e '/^torchvision\b/d' -e '/^torchaudio\b/d' requirements.txt > /tmp/requirements_no_torch.txt \
|
| 26 |
-
&& python -m pip install --no-cache-dir -r /tmp/requirements_no_torch.txt \
|
| 27 |
-
&& python -m pip install --no-cache-dir gradio==6.13.0
|
| 28 |
-
|
| 29 |
-
# Expose port and run the Gradio app
|
| 30 |
-
EXPOSE 7860
|
| 31 |
-
CMD ["python", "app.py"]
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
README.md
CHANGED
|
@@ -1,149 +1 @@
|
|
| 1 |
-
|
| 2 |
-
title: Virtual Try-On
|
| 3 |
-
emoji: 👕
|
| 4 |
-
colorFrom: blue
|
| 5 |
-
colorTo: pink
|
| 6 |
-
sdk: gradio
|
| 7 |
-
app_file: app.py
|
| 8 |
-
pinned: false
|
| 9 |
-
python_version: 3.10
|
| 10 |
-
---
|
| 11 |
-
|
| 12 |
-
# FASHN VTON v1.5: Efficient Maskless Virtual Try-On in Pixel Space
|
| 13 |
-
|
| 14 |
-
<div align="center">
|
| 15 |
-
<a href="https://fashn.ai/research/vton-1-5"><img src='https://img.shields.io/badge/Project-Page-1A1A1A?style=flat' alt='Project Page'></a> 
|
| 16 |
-
<a href='https://huggingface.co/fashn-ai/fashn-vton-1.5'><img src='https://img.shields.io/badge/Hugging%20Face-Model-FFD21E?style=flat&logo=HuggingFace&logoColor=FFD21E' alt='Hugging Face Model'></a> 
|
| 17 |
-
<a href="https://huggingface.co/spaces/fashn-ai/fashn-vton-1.5"><img src='https://img.shields.io/badge/Hugging%20Face-Spaces-FFD21E?style=flat&logo=HuggingFace&logoColor=FFD21E' alt='Hugging Face Spaces'></a> 
|
| 18 |
-
<a href=""><img src='https://img.shields.io/badge/arXiv-Coming%20Soon-b31b1b?style=flat&logo=arXiv&logoColor=b31b1b' alt='arXiv'></a> 
|
| 19 |
-
<a href="LICENSE"><img src='https://img.shields.io/badge/License-Apache--2.0-gray?style=flat' alt='License'></a>
|
| 20 |
-
</div>
|
| 21 |
-
|
| 22 |
-
by [FASHN AI](https://fashn.ai)
|
| 23 |
-
|
| 24 |
-
Virtual try-on model that generates photorealistic images directly in pixel space without requiring segmentation masks.
|
| 25 |
-
|
| 26 |
-
<p align="center">
|
| 27 |
-
<img src="https://static.fashn.ai/repositories/fashn-vton-v15/results/hero_collage.webp" alt="FASHN VTON v1.5 examples" width="900">
|
| 28 |
-
</p>
|
| 29 |
-
|
| 30 |
-
This repo contains minimal inference code to run virtual try-on with the FASHN VTON v1.5 model weights. Given a person image and a garment image, the model generates a photorealistic image of the person wearing the garment. Supports both model photos and flat-lay product shots as garment inputs.
|
| 31 |
-
|
| 32 |
-
---
|
| 33 |
-
|
| 34 |
-
## Local Installation
|
| 35 |
-
|
| 36 |
-
We recommend using a virtual environment:
|
| 37 |
-
|
| 38 |
-
```bash
|
| 39 |
-
git clone https://github.com/fashn-AI/fashn-vton-1.5.git
|
| 40 |
-
cd fashn-vton-1.5
|
| 41 |
-
python -m venv .venv && source .venv/bin/activate
|
| 42 |
-
pip install -e .
|
| 43 |
-
```
|
| 44 |
-
|
| 45 |
-
**Note:** Installation includes `onnxruntime-gpu` for GPU-accelerated pose detection. Ensure CUDA is properly configured on your system. For CPU-only environments, replace with the CPU version:
|
| 46 |
-
|
| 47 |
-
```bash
|
| 48 |
-
pip uninstall onnxruntime-gpu && pip install onnxruntime
|
| 49 |
-
```
|
| 50 |
-
|
| 51 |
-
---
|
| 52 |
-
|
| 53 |
-
## Model Weights
|
| 54 |
-
|
| 55 |
-
Download the required model weights (~2 GB total):
|
| 56 |
-
|
| 57 |
-
```bash
|
| 58 |
-
python scripts/download_weights.py --weights-dir ./weights
|
| 59 |
-
```
|
| 60 |
-
|
| 61 |
-
This downloads:
|
| 62 |
-
- `model.safetensors` — TryOnModel weights from [HuggingFace](https://huggingface.co/fashn-ai/fashn-vton-1.5)
|
| 63 |
-
- `dwpose/` — DWPose ONNX models for pose detection
|
| 64 |
-
|
| 65 |
-
**Note:** The human parser weights (~244 MB) are automatically downloaded on first use to the HuggingFace cache folder. Set `HF_HOME` to customize the location.
|
| 66 |
-
|
| 67 |
-
---
|
| 68 |
-
|
| 69 |
-
## Usage
|
| 70 |
-
|
| 71 |
-
```python
|
| 72 |
-
from fashn_vton import TryOnPipeline
|
| 73 |
-
from PIL import Image
|
| 74 |
-
|
| 75 |
-
# Initialize pipeline (automatically uses GPU if available)
|
| 76 |
-
pipeline = TryOnPipeline(weights_dir="./weights")
|
| 77 |
-
|
| 78 |
-
# Load images
|
| 79 |
-
person = Image.open("examples/data/model.webp").convert("RGB")
|
| 80 |
-
garment = Image.open("examples/data/garment.webp").convert("RGB")
|
| 81 |
-
|
| 82 |
-
# Run inference
|
| 83 |
-
result = pipeline(
|
| 84 |
-
person_image=person,
|
| 85 |
-
garment_image=garment,
|
| 86 |
-
category="tops", # "tops" | "bottoms" | "one-pieces"
|
| 87 |
-
)
|
| 88 |
-
|
| 89 |
-
# Save output
|
| 90 |
-
result.images[0].save("output.png")
|
| 91 |
-
```
|
| 92 |
-
|
| 93 |
-
### CLI
|
| 94 |
-
|
| 95 |
-
```bash
|
| 96 |
-
python examples/basic_inference.py \
|
| 97 |
-
--weights-dir ./weights \
|
| 98 |
-
--person-image examples/data/model.webp \
|
| 99 |
-
--garment-image examples/data/garment.webp \
|
| 100 |
-
--category tops
|
| 101 |
-
```
|
| 102 |
-
|
| 103 |
-
**Note:** The pipeline automatically uses GPU if available. The try-on model weights are stored in bfloat16 and will run in bf16 precision on Ampere+ GPUs (RTX 30xx/40xx, A100, H100). On older hardware or CPU, weights are converted to float32.
|
| 104 |
-
|
| 105 |
-
See [`examples/basic_inference.py`](examples/basic_inference.py) for additional options.
|
| 106 |
-
|
| 107 |
-
---
|
| 108 |
-
|
| 109 |
-
## Categories
|
| 110 |
-
|
| 111 |
-
| Category | Description |
|
| 112 |
-
|----------|-------------|
|
| 113 |
-
| `tops` | Upper body: t-shirts, blouses, jackets |
|
| 114 |
-
| `bottoms` | Lower body: pants, skirts, shorts |
|
| 115 |
-
| `one-pieces` | Full body: dresses, jumpsuits |
|
| 116 |
-
|
| 117 |
-
---
|
| 118 |
-
|
| 119 |
-
## API
|
| 120 |
-
|
| 121 |
-
FASHN provides a suite of [fashion AI APIs](https://fashn.ai/products/api) including virtual try-on, model generation, image-to-video, and more. See the [docs](https://docs.fashn.ai/) to get started.
|
| 122 |
-
|
| 123 |
-
---
|
| 124 |
-
|
| 125 |
-
## Citation
|
| 126 |
-
|
| 127 |
-
If you use FASHN VTON v1.5 in your research, please cite:
|
| 128 |
-
|
| 129 |
-
```bibtex
|
| 130 |
-
@article{bochman2026fashnvton,
|
| 131 |
-
title={FASHN VTON v1.5: Efficient Maskless Virtual Try-On in Pixel Space},
|
| 132 |
-
author={Bochman, Dan and Bochman, Aya},
|
| 133 |
-
journal={arXiv preprint},
|
| 134 |
-
year={2026},
|
| 135 |
-
note={Paper coming soon}
|
| 136 |
-
}
|
| 137 |
-
```
|
| 138 |
-
|
| 139 |
-
---
|
| 140 |
-
|
| 141 |
-
## License
|
| 142 |
-
|
| 143 |
-
Apache-2.0. See [LICENSE](LICENSE) for details.
|
| 144 |
-
|
| 145 |
-
**Third-party components:**
|
| 146 |
-
- [DWPose](https://github.com/IDEA-Research/DWPose) (Apache-2.0)
|
| 147 |
-
- [YOLOX](https://github.com/Megvii-BaseDetection/YOLOX) (Apache-2.0)
|
| 148 |
-
- [fashn-human-parser](https://github.com/fashn-AI/fashn-human-parser) ([License](https://github.com/fashn-AI/fashn-human-parser?tab=readme-ov-file#license))
|
| 149 |
-
|
|
|
|
| 1 |
+
python_version: 3.10
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
requirements.txt
CHANGED
|
@@ -1,78 +1,11 @@
|
|
| 1 |
-
annotated-doc==0.0.4
|
| 2 |
-
annotated-types==0.7.0
|
| 3 |
-
anyio==4.13.0
|
| 4 |
-
brotli==1.2.0
|
| 5 |
-
certifi==2026.4.22
|
| 6 |
-
click==8.3.3
|
| 7 |
-
colorama==0.4.6
|
| 8 |
-
coloredlogs==15.0.1
|
| 9 |
-
contourpy==1.3.2
|
| 10 |
-
cycler==0.12.1
|
| 11 |
-
einops==0.8.2
|
| 12 |
-
exceptiongroup==1.3.1
|
| 13 |
-
fashn-human-parser==0.1.1
|
| 14 |
-
-e git+https://github.com/fashn-AI/fashn-vton-1.5.git@7c0f10af3f91ad4048fe9729c470a13ef905d25a#egg=fashn_vton
|
| 15 |
-
fastapi==0.136.1
|
| 16 |
-
filelock==3.25.2
|
| 17 |
-
flatbuffers==25.12.19
|
| 18 |
-
fonttools==4.62.1
|
| 19 |
-
fsspec==2026.2.0
|
| 20 |
-
gradio==6.13.0
|
| 21 |
-
gradio_client==2.5.0
|
| 22 |
-
groovy==0.1.2
|
| 23 |
-
h11==0.16.0
|
| 24 |
-
hf-gradio==0.4.1
|
| 25 |
-
hf-xet==1.4.3
|
| 26 |
-
httpcore==1.0.9
|
| 27 |
-
httpx==0.28.1
|
| 28 |
-
huggingface_hub==1.11.0
|
| 29 |
-
humanfriendly==10.0
|
| 30 |
-
idna==3.13
|
| 31 |
-
Jinja2==3.1.6
|
| 32 |
-
kiwisolver==1.5.0
|
| 33 |
-
markdown-it-py==4.0.0
|
| 34 |
-
MarkupSafe==3.0.3
|
| 35 |
-
matplotlib==3.10.9
|
| 36 |
-
mdurl==0.1.2
|
| 37 |
-
mpmath==1.3.0
|
| 38 |
-
networkx==3.4.2
|
| 39 |
-
numpy==2.2.6
|
| 40 |
-
onnxruntime==1.20.0
|
| 41 |
-
opencv-python==4.13.0.92
|
| 42 |
-
orjson==3.11.8
|
| 43 |
-
packaging==26.0
|
| 44 |
-
pandas==2.3.3
|
| 45 |
-
pillow==12.1.1
|
| 46 |
-
protobuf==7.34.1
|
| 47 |
-
pydantic==2.13.3
|
| 48 |
-
pydantic_core==2.46.3
|
| 49 |
-
pydub==0.25.1
|
| 50 |
-
Pygments==2.20.0
|
| 51 |
-
pyparsing==3.3.2
|
| 52 |
-
pyreadline3==3.5.4
|
| 53 |
-
python-dateutil==2.9.0.post0
|
| 54 |
-
python-multipart==0.0.26
|
| 55 |
-
pytz==2026.1.post1
|
| 56 |
-
PyYAML==6.0.3
|
| 57 |
-
regex==2026.4.4
|
| 58 |
-
rich==15.0.0
|
| 59 |
-
safehttpx==0.1.7
|
| 60 |
-
safetensors==0.7.0
|
| 61 |
-
semantic-version==2.10.0
|
| 62 |
-
shellingham==1.5.4
|
| 63 |
-
six==1.17.0
|
| 64 |
-
starlette==1.0.0
|
| 65 |
-
sympy==1.13.1
|
| 66 |
-
tokenizers==0.22.2
|
| 67 |
-
tomlkit==0.14.0
|
| 68 |
torch==2.2.2
|
| 69 |
torchvision
|
| 70 |
-
|
| 71 |
-
|
| 72 |
-
|
| 73 |
-
|
| 74 |
-
|
| 75 |
-
|
| 76 |
-
|
| 77 |
-
|
| 78 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
torch==2.2.2
|
| 2 |
torchvision
|
| 3 |
+
diffusers
|
| 4 |
+
transformers
|
| 5 |
+
accelerate
|
| 6 |
+
safetensors
|
| 7 |
+
pillow
|
| 8 |
+
opencv-python
|
| 9 |
+
gradio
|
| 10 |
+
onnxruntime
|
| 11 |
+
git+https://github.com/fashn-AI/fashn-vton-1.5.git
|