hauteuar/Dress_swap_beta
3
Check out the configuration reference at https://huggingface.co/docs/hub/spaces-config-reference
๐งฅ Virtual Try-On with Gradio for Hugging Face Spaces
This is a CPU-compatible virtual try-on application that allows users to see themselves wearing different garments. The app uses a simplified version of Stable Diffusion with inpainting to create realistic try-on results, optimized to run without GPU requirements.
Features
- Upload your own photo
- Upload garment images to try on
- Simple interface built with Gradio
- CPU-optimized for Hugging Face Spaces deployment
- Automatic torso segmentation
How It Works
- Image Upload: Users upload their photo and a garment image
- Body Segmentation: The system identifies the torso region
- Virtual Try-On: Using Stable Diffusion's inpainting capabilities, the system replaces the torso region with the garment
- Result Display: The final try-on result is shown to the user
Deployment Instructions
Option 1: Deploy to Hugging Face Spaces
- Create a new Space on Hugging Face Spaces
- Select Gradio as the SDK
- Upload these files to your Space repository
- The app will automatically build and deploy
Option 2: Run Locally
# Clone the repository
git clone [your-repo-url]
cd [your-repo-name]
# Install dependencies
pip install -r requirements.txt
# Run the app
python app.pyOptimizations
This version has been specifically optimized for CPU environments:
- Uses a smaller Stable Diffusion 1.5 model instead of SDXL
- Implements efficient CPU offloading
- Reduces the number of inference steps
- Uses simplified segmentation techniques
- Provides clear expectations about processing time
Integration with Websites
To embed this app in your website:
<iframe
src="https://huggingface.co/spaces/your-username/your-space-name"
frameborder="0"
width="850"
height="600"
></iframe>Limitations
- Processing time on CPU is significantly longer (5-10 minutes per image)
- Segmentation is simplified and may not be as precise
- Image quality is reduced compared to GPU versions
- Complex garments may not transfer as accurately
Future Improvements
- Add pre-trained body segmentation for better accuracy
- Implement caching for faster results
- Add garment color customization options
- Support for multiple garment try-on simultaneously
Credits
This implementation is based on Stable Diffusion by Runway and Stability AI, with optimizations for CPU performance and Gradio interface.
