--- title: Stable Diffusion Lab emoji: 🎨 colorFrom: indigo colorTo: pink sdk: gradio sdk_version: 6.30.0 python_version: "3.12" app_file: app.py pinned: false license: creativeml-openrail-m short_description: Explore Stable Diffusion with live denoising previews --- # Stable Diffusion Lab A teaching Space for exploring text-to-image diffusion. Students can set: - positive and negative prompt - CFG scale (0.0 to 15.0) and denoising steps (4 to 48) - sampler: Euler, Euler Ancestral, DDIM, UniPC - checkpoint: Stable Diffusion 1.5 or Realistic Vision V6.0 - seed (or a random seed) and resolution (512x512 by default, 256 to 768 px) While an image is generated, a live preview of the denoising is streamed to the page. ## Hardware Designed for a dedicated GPU (fp16, about 6 GB VRAM for both checkpoints). It also runs on CPU, but slowly. Both checkpoints load at startup, so the first build takes a few minutes while the weights download. ## How the live preview works The app runs its own denoising loop. At every step the U-Net predicts the noise, and from that prediction the app computes the model's current guess of the final image. That guess is decoded with TAESD, a tiny and fast VAE decoder. The final step uses the full VAE of the checkpoint. ## Settings (Space variables) | Variable | Default | Meaning | | --- | --- | --- | | `SAFETY_CHECKER` | `1` | Set to `0` to turn off the NSFW filter (it can flag harmless art) | | `MAX_CONCURRENT` | `1` | Generations running at the same time | | `PRELOAD` | `1` | Load both checkpoints at startup instead of on first use | | `SD15_REPO` | `sd-legacy/stable-diffusion-v1-5` | Base model repo (the original runwayml repo is deprecated) | | `RV_REPO`, `RV_FILE` | Realistic Vision V6.0 B1 noVAE, fp16 file | Finetuned checkpoint | | `RV_VAE_REPO` | `stabilityai/sd-vae-ft-mse` | VAE for Realistic Vision, whose repo ships without one | ## Licenses Both checkpoints use the CreativeML OpenRAIL-M license.