Skip to main content
Module

x/stable_diffusion_client/mod.ts>StableDiffusionApi

stable-diffusion-webui Client writen in Deno
Latest
class StableDiffusionApi
import { StableDiffusionApi } from "https://deno.land/x/stable_diffusion_client@0.1.0/mod.ts";

Examples

const api = new StableDiffusionApi() const result = await api.txt2img({ prompt: "A computer that has more brain power than a human being", batch_size: 2, })

// Save the first image result.image.toFile("result.png")

// Save all images result.images.forEach((image, i) => { image.toFile(result_${i}.png) })

Constructors

new
StableDiffusionApi(unnamed 0?: StableDiffusionApiConfig)

Properties

private
baseURL: URL
private
basicAuth: string
ControlNet: ControlNetApi

Methods

Stable Diffusion extra's call for batch images

Stable Diffusion extra's call for single images

get<T>(uri: string): Promise<T>
getCmdFlags(): Promise<CmdFlags>

Gets the list of command line flags that are available

getCurrentModel(): Promise<string>

Gets the name of the current Stable Diffusion checkpoint being used

Gets the list of face restorers

Gets the list of hypernetworks

getOptions(): Promise<SDOption>
getProgress(skipCurrentImage?: boolean): Promise<Progress>

Gets the progress status of the current session

Gets the list of Stable Diffusion prompt styles

Gets the list of Real-ESRGAN models

getSamplers(): Promise<Sampler[]>

Gets the list of samplers

Gets the list of Stable Diffusion models

getUpscalers(): Promise<Upscaler[]>

Gets the list of upscalers

Stable Diffusion img2img call

interrogate(image: Sharp, model: string): Promise<StableDiffusionResult<unknown, unknown>>

Interrogates an image with an interrogation model

pngInfo(image: Sharp): Promise<StableDiffusionResult<unknown, unknown>>

Gets the info of a png image

post<T>(uri: string, body?: unknown): Promise<T>
refreshCheckpoints(): Promise<void>

Refreshes the list of Stable Diffusion checkpoints

setAuth(username: string, password: string): StableDiffusionApi

Set the authentication for the axios API

setModel(name: string, findClosest?: boolean): Promise<void>

Sets the Stable Diffusion checkpoint to use

setOptions(options: Partial<SDOption>)

Stable Diffusion txt2img call

waitForReady(checkInterval?: number): Promise<boolean>

Waits for the Stable Diffusion server to be ready to accept new requests