A web application that allows users to virtually try on garments using Google's Virtual Try-On API.
- Upload full-body person images and garment images
- Automatic image validation and preprocessing
- Background removal for garments
- Image resizing to 512x512 for API compatibility
- Side-by-side comparison of original and try-on results
- Multiple garment support without re-uploading person image
- Zoom functionality for detailed viewing
- Download try-on results
- Responsive design
- Install dependencies:
pip install -r requirements.txt
- Set up Google Cloud credentials:
export GOOGLE_CLOUD_PROJECT="your-project-id" export GOOGLE_CLOUD_LOCATION="us-central1" export GOOGLE_APPLICATION_CREDENTIALS="path/to/service-account-key.json"
- Run the application:
python app.py
- Open browser to
http://localhost:5000
- Upload a full-body image of a person
- Upload one or more garment images
- Click "Try On" to generate the result
- View comparison, zoom, and download the result
- Switch between multiple garments without re-uploading person image
- Python 3.8+
- Google Cloud Project with Virtual Try-On API enabled
- Service account with appropriate permissions
The application uses Google Vertex AI Virtual Try-On API. Ensure:
- API is enabled in your Google Cloud project
- Endpoint is properly configured
- Service account has necessary permissions
- Invalid image formats are rejected
- Person images must be full-body (height > width * 1.2)
- Garment images must be at least 100x100 pixels
- API errors are displayed to users with retry options
- Graceful handling of network issues and API downtime