SD-Explorer / README.md
Pixelkram's picture
Upload 3 files
f48b9d7 verified
|
Raw History Blame Contribute Delete
1.59 kB

A newer version of the Gradio SDK is available: 6.31.0

Upgrade
metadata
title: Text Embedding Explorer for SD 1.5
colorFrom: blue
colorTo: indigo
sdk: gradio
sdk_version: 6.30.0
app_file: app.py
suggested_hardware: t4-small
short_description: Explore and edit text embeddings in Stable Diffusion 1.5
pinned: false

Text Embedding Explorer for Stable Diffusion 1.5

A Gradio Space for BA creative coding students. Instead of changing the prompt text, you change the text embedding (the 77 x 768 numbers that Stable Diffusion 1.5 actually receives).

Tabs:

  1. Interpolate blends two prompts (lerp or slerp, with optional extrapolation).
  2. Arithmetic computes A - B + C on embeddings.
  3. Edit tokens scales or blends single tokens of a prompt and shows original and edit side by side.
  4. Map draws a 2D PCA map and a similarity matrix of words or prompts.

All images within one run share the same noise (seed), so differences come from the embedding only.

Hardware

Made for a dedicated GPU such as t4-small. Typical time on a T4 is a few seconds per image at 512 px and 20 steps. On CPU it runs but takes minutes per image.

Settings

Optional environment variables (Space settings, Variables):

  • MODEL_ID loads another SD 1.5 compatible repo. Default is stable-diffusion-v1-5/stable-diffusion-v1-5.
  • DISABLE_SAFETY_CHECKER=1 turns off the NSFW filter. It is on by default. Odd embedding mixes can occasionally trigger it, which shows up as a black image.

Run locally

pip install -r requirements.txt gradio==6.30.0
python app.py

The model is downloaded from the Hugging Face Hub on first start.