0.0.14 • Published 11 months ago

@omersalkanovic/node-sd-webui v0.0.14

Weekly downloads
-
License
MIT
Repository
-
Last release
11 months ago

Node Stable Diffusion Web UI Client

npm version

A Node.js client for using Automatic1111's Stable Diffusion Web UI.

Current Features

This project is a work in progress. Current features include:

  • txt2img generation
  • img2img generation
  • pngInfo support

Extensions

  • ControlNet support both txt2img and img2img

Getting Started

Requirements

Installation

Add node-sd-webui to your project.

Using npm:

npm i -S node-sd-webui

Using yarn:

yarn add node-sd-webui

Using pnpm:

pnpm add node-sd-webui

Usage

txt2img

The txt2img function allows you to generate an image using the txt2img functionality of the Stable Diffusion WebUI.

Basic Example:

import sdwebui from 'node-sd-webui'
import { writeFileSync } from 'fs'

sdwebui()
  .txt2img({
    prompt: 'A photo of a mushroom',
  })
  .then(({ images }) => writeFileSync('path/to/image.png', images[0], 'base64'))
  .catch((err) => console.error(err))

Another example with a few more options:

import sdwebui, { SamplingMethod } from 'node-sd-webui'
import { writeFileSync } from 'fs'

const client = sdwebui()

try {
  const { images } = await client.txt2img({
    prompt: 'A photo of a mushroom, red cap, white spots',
    negativePrompt: 'blurry, cartoon, drawing, illustration',
    samplingMethod: SamplingMethod.Euler_A,
    width: 768,
    height: 512,
    steps: 20,
    batchSize: 5,
  })

  images.forEach((image, i) =>
    writeFileSync(`path/to/image-${i}.png`, images[i], 'base64')
  )
} catch (err) {
  console.error(err)
}
0.0.14

11 months ago

0.0.13

11 months ago

0.0.12

11 months ago

0.0.11

11 months ago

0.0.10

11 months ago

0.0.9

11 months ago

0.0.8

11 months ago

0.0.7

11 months ago

0.0.6

11 months ago

0.0.5

11 months ago

0.0.4

11 months ago

0.0.3

11 months ago

0.0.2

11 months ago

0.0.1

11 months ago