StyleForge AI is an AI-powered Neural Style Transfer web application built with Flask and PyTorch. It uses Adaptive Instance Normalization (AdaIN) to blend the artistic style of one image with the structural content of another, producing high-quality stylized artwork in just a few seconds.
The application provides an intuitive web interface where users can upload a content image and a style reference image, adjust the style strength, and generate a unique artistic output.
- 🖼️ Upload content and style images
- 🎨 AI-powered Neural Style Transfer using AdaIN
- 🎛️ Adjustable style strength slider
- ⚡ Fast inference with PyTorch
- 🖥️ Interactive Flask web interface
- 📥 Download generated stylized images
- 🖼️ Built-in example gallery
- 📱 Responsive modern UI
- 🧠 VGG Encoder + Trained Decoder architecture
- Content Image
- Style Reference
↓
- VGG Encoder
- Adaptive Instance Normalization (AdaIN)
- Decoder Network
↓
- Stylized AI Artwork
- Python
- Flask
- PyTorch
- Torchvision
- HTML5
- CSS3
- Bootstrap 5
- JavaScript
- Pillow
- Flask-WTF
- WTForms
StyleForge-AI/
│
├── README.md
├── requirements.txt
├── Procfile.txt
├── code.ipynb
│
├── Demo_IO_Images/
│ ├── i-p/
│ └── o-p/
│
└── NST_Code/
├── app.py
├── train.py
├── vgg_normalised.pth
├── adain_algo.png
│
├── content_data/
├── style_data/
├── examples/
├── static/
│ └── uploads/
│
├── templates/
│ └── index.html
│
├── experiment/
│ └── final_exp/
│ ├── decoder_final.pth
│ └── sample_iter_*.png
│
└── utils/
├── models.py
└── utils.py
git clone https://github.com/yourusername/StyleForge-AI.git
cd StyleForge-AIpython -m venv .venv
.\.venv\Scripts\activateIf activation is blocked:
Set-ExecutionPolicy -Scope Process -ExecutionPolicy Bypass
.\.venv\Scripts\activatepip install --upgrade pip
pip install -r requirements.txtpython NST_Code/app.pyOpen your browser:
http://localhost:5000
This project does not commit large model files to GitHub. For Render deployment, upload these two local files to a public downloadable location such as Google Drive, Hugging Face, or GitHub Releases:
NST_Code/vgg_normalised.pthNST_Code/experiment/final_exp/decoder_final.pth
In Render, create a Web Service or use the included render.yaml blueprint, then add these environment variables:
VGG_MODEL_URL=<public download URL for vgg_normalised.pth>
DECODER_MODEL_URL=<public download URL for decoder_final.pth>
Render start command:
python download_models.py && gunicorn --chdir NST_Code app:appUpload a Content Image
↓
Upload a Style Image
↓
Adjust the Style Strength
↓
Click Transfer Style
↓
Download the generated artwork
Content Image
│
▼
VGG Encoder
│
▼
Content Features
Style Image
│
▼
VGG Encoder
│
▼
Style Features
│
▼
Adaptive Instance Normalization (AdaIN)
│
▼
Stylized Features
│
▼
Decoder Network
│
▼
Generated Artwork
adaptive_instance_normalization(content_feat, style_feat)AdaIN transfers the statistical properties (mean and standard deviation) of the style features to the content features, enabling artistic style transfer while preserving the original image structure.
Training script:
cd NST_Code
python train.py \
--content_dir content_data \
--style_dir style_data \
--vgg vgg_normalised.pth \
--experiment my_exp \
--epochs 10Note: GPU is recommended for training.
| File | Description |
|---|---|
app.py |
Flask routes and inference pipeline |
train.py |
Model training script |
models.py |
VGG Encoder and Decoder architecture |
utils.py |
AdaIN implementation and utilities |
index.html |
Frontend interface |
requirements.txt |
Project dependencies |
Install Python and enable
Add Python to PATH
Verify installation
python --versionEnsure the following files exist:
NST_Code/vgg_normalised.pth
NST_Code/experiment/final_exp/decoder_final.pth
Set-ExecutionPolicy -Scope Process -ExecutionPolicy Bypasspip install --upgrade -r requirements.txt- Supports JPG, JPEG, and PNG
- Generated images are stored inside:
NST_Code/static/uploads/
- First inference may take a few seconds because model weights are loaded.
- CUDA GPU is recommended for faster inference.
- 🎭 Multiple built-in artistic styles
- ⚡ Real-time style preview
- 📱 Drag & Drop image upload
- 🖼️ Batch image stylization
- ☁️ Cloud deployment
- 📊 Image comparison slider
- 🧠 More advanced style transfer models
This project is inspired by the research on Arbitrary Style Transfer using Adaptive Instance Normalization (AdaIN) and is built using PyTorch, Flask, and VGG-based feature extraction.
Sumit Jaiswal
💻 Passionate about AI, Machine Learning, Computer Vision, and Full-Stack Development.

