CodeVetter · Repo Unpack · Feature catalog
AUTOMATIC1111/stable-diffusion-webui
User-facing features split across Gradio tabs (txt2img, img2img with six sub-modes, Extras upscaling/face-fix, PNG Info, Train for embeddings/hypernetworks, Checkpoint Merger, Settings, Extensions manager) and a ~40-route /sdapi/v1 REST API. Core generation supports txt2img/img2img/inpainting, hires-fix (second-pass upscale), ~30 samplers across k-diffusion/timesteps/LCM families, prompt scheduling and extra-network syntax, selectable scripts (xyz_grid, prompt_matrix, loopback, outpainting, sd_upscale, custom_code), and training of textual-inversion embeddings and hypernetworks.
- txt2img: UI calls modules/txt2img.py txt2img() → txt2img_create_processing() builds StableDiffusionProcessingTxt2Img with prompt/negative/styles/batch/cfg/hires-fix params (enable_hr, hr_scale, hr_upscaler, hr_second_pass_steps, hr_checkpoint_name) and per-request override_settings.
- img2img + inpainting: modules/img2img.py builds StableDiffusionProcessingImg2Img (init_images, mask, denoising_strength, inpainting fields); the Gradio tab exposes six modes (img2img, Sketch, Inpaint, Inpaint sketch, Inpaint upload, Batch).
- REST API exposes POST /sdapi/v1/txt2img, /img2img, /extra-single-image, /extra-batch-images, /png-info, /interrogate, /interrupt, /skip, plus GETs for options, samplers, schedulers, upscalers, sd-models, sd-vae, hypernetworks, face-restorers, realesrgan-models, prompt-styles, embeddings, memory, scripts, script-info, extensions; POSTs for options, refresh-*, create/train embedding+hypernetwork, unload/reload-checkpoint.
- API auth is optional HTTP Basic via --api-auth 'user:pass,...' checked with secrets.compare_digest; the API also accepts image payloads as base64 or http(s) URLs, the latter gated by opts.api_enable_requests and SSRF-checked by verify_url() + opts.api_forbid_local_requests.
- Sampler catalog is assembled in modules/sd_samplers.py from three families: sd_samplers_kdiffusion.samplers_data_k_diffusion, sd_samplers_timesteps.samplers_data_timesteps, sd_samplers_lcm.samplers_data_lcm; schedulers (Automatic/Karras/Exponential/etc.) live in modules/sd_schedulers.py and can be encoded in the sampler name suffix ('Euler a Karras').
- Prompt language supports attention weights ((word), (word:1.2)), prompt editing/scheduling ([a:b:step], [a|b] alternation) parsed by modules/prompt_parser.py get_learned_conditioning_prompt_schedules/parse_prompt_attention, and extra-network tags <name:args> extracted by extra_networks.parse_prompt.
- Built-in 'scripts' in scripts/ are user-selectable generation programs: xyz_grid.py (X/Y/Z parameter plots), prompt_matrix.py, loopback.py, sd_upscale.py, outpainting_mk_2.py, poor_mans_outpainting.py, img2imgalt.py, prompts_from_file.py, custom_code.py (arbitrary Python, requires --allow-code), plus postprocessing_* wrappers.
- Extras tab does single/batch image postprocessing (upscale via ESRGAN/RealESRGAN/SwinIR/LDSR/ScuNET/DAT upscalers, GFPGAN/CodeFormer face restoration) via modules/postprocessing.py and modules/ui_postprocessing.py, exposed to API as /sdapi/v1/extra-single-image and /extra-batch-images.
- Train tab + API can create and train textual-inversion embeddings (textual_inversion.create_embedding/train_embedding) and hypernetworks (create_hypernetwork/train_hypernetwork), with preview images routed through txt2img params.
- PNG Info tab + /sdapi/v1/png-info parse generation parameters ('infotext') embedded in PNG text chunks or JPEG/WEBP EXIF UserComment; modules/infotext_utils.py handles parse_generation_parameters and send-to-txt2img/img2img paste.
- Extra Networks UI (modules/ui_extra_networks.py) renders browsable card pages for checkpoints, textual inversion, hypernetworks, and Lora (registered by extensions-builtin/Lora) with per-file .json user metadata (extra_networks.get_user_metadata) served as in-app HTML pages via add_pages_to_demo.
- Checkpoint Merger tab (modules/ui_checkpoint_merger.py) merges two/three checkpoints into a new .safetensors file; Settings tab (modules/ui_settings.py) edits the OptionInfo registry with quicksettings bar, search, and per-setting apply/restart semantics.
- Extensions tab (modules/ui_extensions.py) lists installed extensions with git update status (check_updates/fetch_and_reset_hard), installs new ones from a URL or the built-in index, manages disable lists persisted to config.json, and can save/restore whole config states into config_states/ JSON backups.
- Progress/interruption features: modules/progress.py exposes /internal/progress and /internal/pending-tasks; shared_state.State supports skip/interrupt/stop generation and server stop/restart commands; /sdapi/v1/progress returns live ETA/current image.
- ngrok tunneling (--ngrok token) and gradio --share provide remote access; TLS via --tls-keyfile/--tls-certfile; --listen/--server-name control bind address; Gradio auth via --gradio-auth/--gradio-auth-path; subpath for reverse proxies via --subpath.