A fashion virtual try-on web application that lets users select clothing items and generates professional outfit photos using Azure OpenAI's GPT-Image-1.
- Interactive Web App - Browse products by category, select items, and generate looks
- AI Outfit Generation - Combines multiple clothing items into a single professional photo
- Shopping Cart - Save looks to cart with size selection, remove individual items
- Product Catalog - Organized by categories: Pants, Skirts, Dresses, Jackets, Sweaters, Shoes
- Modern UI - Clean, responsive design with smooth animations
- Python 3.10+
- Azure subscription with Azure OpenAI (GPT-Image-1 deployed)
- Azure CLI installed
git clone https://github.com/SyChell/VirtualTryOn.git
cd VirtualTryOn
pip install -r requirements.txtCopy .env.example to .env and fill in your values:
# Required: Azure OpenAI
AOAI_API_BASE=https://your-resource.cognitiveservices.azure.com
AOAI_DEPLOYMENT_NAME=gpt-image-1
AOAI_API_VERSION=2025-04-01-preview
# Optional: Microsoft Fabric Eventstreams
FABRIC_EH_SALES_CONNECTION_STRING=Endpoint=sb://...
FABRIC_EH_COMBINATIONS_CONNECTION_STRING=Endpoint=sb://...az loginpython app.pyOpen http://localhost:5000 in your browser.
VirtualTryOn/
├── app.py # Flask web server & API endpoints
├── agent.py # AI image generation (Azure OpenAI)
├── fabric_client.py # Microsoft Fabric Eventstream integration
├── requirements.txt # Python dependencies
├── .env # Configuration (not committed)
├── .env.example # Configuration template
├── data/
│ └── catalog.json # Product catalog
├── static/
│ ├── css/styles.css # Styling
│ ├── js/app.js # Frontend logic
│ ├── products/ # Product images by category
│ └── generated/ # Generated outfit images
└── templates/
└── index.html # Main page
- Browse Products - Select items from different categories
- Generate Look - Click "Look Generieren" to create an outfit
- AI Processing - Azure OpenAI combines clothing images into one photo
- Add to Cart - Select sizes and save the look to your cart
- Place Order - Order data is sent to Microsoft Fabric for analytics
User selects items → Flask API → Azure OpenAI → Generated outfit
↓
Microsoft Fabric Eventstreams (combinations + orders)
Use main.ipynb for testing the AI generation independently:
- Open in VS Code or Jupyter
- Update
IMAGES_FOLDERto point to product images (e.g.,./static/products/hosen) - Run all cells to generate an outfit
| Variable | Description | Required |
|---|---|---|
AOAI_API_BASE |
Azure OpenAI endpoint | Yes |
AOAI_DEPLOYMENT_NAME |
Model deployment name | Yes |
AOAI_API_VERSION |
API version | Yes |
FABRIC_EH_SALES_CONNECTION_STRING |
Fabric Sales Eventstream connection string | No |
FABRIC_EH_COMBINATIONS_CONNECTION_STRING |
Fabric Combinations Eventstream connection string | No |
Create a .env file with your Azure OpenAI endpoint.
Run az login and ensure you're signed into the correct subscription.
Check that product images exist in static/products/<category>/ and filenames match catalog.json.
- Verify GPT-Image-1 is deployed in Azure OpenAI
- Check Azure CLI authentication:
az account show
- Check that connection strings are set in
.env - Verify the Eventstream "Custom App" source is configured in Fabric
The app sends data to Microsoft Fabric Eventstreams for analytics:
- Combinations Stream - Tracks outfit combinations users generate
- Sales Stream - Tracks orders placed
Combination:
{
"combination_id": "abc123...",
"user_id": "user-xyz",
"items": [{"product_id": "...", "name": "...", "price": 99.95, "color": "..."}]
}Order:
{
"order_id": "uuid",
"combination_id": "abc123...",
"user_id": "user-xyz",
"items": [...]
}- Open Microsoft Fabric workspace
- Go to your Eventstream
- Add a Custom App source
- Copy the connection string from the source settings
- Flask - Web framework
- Flask-CORS - Cross-origin support
- azure-eventhub - Microsoft Fabric Eventstream integration
- requests - HTTP client
- python-dotenv - Environment variables