Skip to content

zombieyang/diffusion-chain

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

28 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Diffusion-Chain

A jsapi to invoke StableDiffusion or ComfyUI.

Usage

launch your StableDiffusion with --api

import { A1111Server, GenerateSession } from 'diffusion-chain'
const server = new A1111Server("http:https://127.0.0.1:7860");
const session = new GenerateSession();
session.modelCheckpoint = 'majicmixSombre_v20.safetensors [5c9a81db7a]'

session.prompt = `
cute cat
`

server.ping.then(isAlive => { console.log(isAlive) })

server.generate(session, { batch: 1 })
    .then(res=> {
        res.forEach(image=> {
            console.log(image) // the base64 of image
        })
    })

also support comfyUI and SDXL now:

import { ComfyServer, GenerateSession } from 'diffusion-chain'
const server = new ComfyServer("http:https://127.0.0.1:8188");
const session = new GenerateSession();
session.modelCheckpoint = 'sd_xl_base_1.0_0.9vae.safetensors'
session.modelCheckpointRefiner = 'sd_xl_refiner_1.0_0.9vae.safetensors'

session.prompt = `
cute cat
`

server.generate(session, { batch: 1 })
    .then(res=> {
        res.forEach(image=> {
            console.log(image) // the base64 of image
        })
    })

More parameter

see schema.ts

About

use diffusion's api in Javascript.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published