Spaces:
Sleeping
Sleeping
A newer version of the Gradio SDK is available: 6.20.0
metadata
title: StyleGAN v1
emoji: π¨
colorFrom: blue
colorTo: purple
sdk: gradio
sdk_version: 5.49.0
app_file: app.py
python_version: '3.11'
pinned: false
license: mit
StyleGAN v1 β Image generation
Generate images with your trained StyleGAN v1 generator.
How to use
- Number of images: Choose how many images to generate (1β16).
- Resolution: Select output resolution (4 up to 256).
- Random seed (optional): Set a seed for reproducible samples.
- Click Generate.
Adding your weights to this Space
Your trained weights must be in this repo so the app can load them.
Option A: Keras weights (recommended)
- Save your generator in training with:
generator.save_weights("weights/generator.weights.h5") - Create a
weightsfolder in this repo and uploadgenerator.weights.h5there. - Or push the file with Git LFS if it is large:
git lfs install git lfs track "weights/*.h5" git add weights/generator.weights.h5 .gitattributes git commit -m "Add generator weights" git push
Option B: State checkpoint (gen_state)
If your training script saves a checkpoint with ema_trainable and non_trainable (e.g. with pickle):
- Save it as
weights/gen_state.pkl. - Add the
weightsfolder andgen_state.pklto this repo (or use Git LFS for large files).
Run locally
pip install -r requirements.txt
# Add your weights to weights/generator.weights.h5 (or weights/gen_state.pkl)
gradio app.py
Open http://localhost:7860 in your browser.
Project structure
app.pyβ Gradio UI and entrypoint for the Spaceinference.pyβ Loads weights and runs generationloading_model.pyβ Builds the StyleGAN generatorlayers.pyβ Generator/discriminator layersconfiguration.pyβ Resolutions and hyperparametersweights/β Put your generator weights here