An interactive neural style transfer demo built on a frozen VGG19 feature extractor. The project refactors the final implementation from notebooks/experiments.ipynb into a small Gradio application that supports sample images, custom uploads, progressive intermediate outputs, and start/stop control for long-running optimization.
Example
mona_lisa.jpg
+
spiral.jpg
=
sample_mn.webp
Features
VGG19-based optimization style transfer
Progressive intermediate snapshots during generation
Sample content and style image selection from data/
Custom content and style uploads
Runtime tracking and stop control in the UI
Hugging Face Spaces-ready entrypoint
Method
The backend follows the notebook implementation closely:
VGG19 is used as a frozen feature extractor
style loss is computed from Gram matrices of selected feature maps
content loss is computed from selected content features
LBFGS performs the image optimization
intermediate states are streamed to the frontend during optimization
Sample Assets
Content samples are loaded from data/content/:
cat.jpg
face.jpg
mona_lisa.jpg
Style samples are loaded from data/style/:
abstract.jpg
spiral.jpg
starry_night.jpg
tiles.jpg
Any additional supported image files added to those folders will appear automatically in the app.
Local Development
Install dependencies:
uv sync
Run the app locally:
uv run python -m src.main
You can also run the Hugging Face Spaces entrypoint directly:
uv run python app.py
Hugging Face Spaces
This repository is configured for a Gradio Space:
README.md includes the required Spaces YAML metadata