Skip to content

CLI Tools

Vladimir Mandic edited this page Feb 7, 2025 · 2 revisions

Stable-Diffusion Productivity Scripts

Generate

  • api-txt2img.py: run generate using text-to-image
  • api-img2img.py: run generate using image-to-image
  • api-control.py: run generate using control-interface
  • api-faceid.py: run generate using face id
  • api-pulid.js: run generate using pulid

Information

  • api-progress.py: get progress of a job
  • api-info.py: get image metadata

Other API examples

  • api-upscale.py: run image upscaling

  • api-detect.py: detect faces in images

  • api-json.py: send json to any api endpoint

  • api-mask.py: run image masking with advanced options

  • api-preprocess.py: run image preprocessing

  • api-vqa.py: run visual question answering

  • api-interrogate.py: interrogate images using clip

  • run-benchmark.py: run benchmark tests

JavaScript

  • api-txt2img.js: run generate using text-to-image
  • api-model.js: load model

Helper scripts

  • validate-locale.py: validate locale files
  • lcm-convert.py: convert lcm models
  • video-extract.py: extract frames from video files
  • install-sf.py: install stablefast
  • zluda-python.py: install zluda

Utilities

  • nvidia-smi.py: get GPU information
  • image-grid.py: create image grid
  • image-exif.py: extract exif data from images
  • image-palette.py: extract color palette from images
  • image-watermark.py: create invisible image watermark
  • gen-styles.py: generate styles from lines in text file
  • model-metadata.py: get model metadata

API Examples

Generate

Text-to-image with all of the possible parameters
Supports upsampling, face restoration and grid creation

python cli/generate.py

By default uses parameters from generate.json

Parameters that are not specified will be randomized:

  • Prompt will be dynamically created from template of random samples: random.json
  • Sampler/Scheduler will be randomly picked from available ones
  • CFG Scale set to 5-10

Utility Scripts

SDAPI

Utility module that handles async communication to Automatic API endpoints
Note: Requires SD API

Can be used to manually execute specific commands:

python sdapi.py progress
python sdapi.py interrupt python sdapi.py shutdown

Clone this wiki locally