Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/jakiestfu/stability-ts
DreamStudio Client written in TypeScript
https://github.com/jakiestfu/stability-ts
Last synced: 7 days ago
JSON representation
DreamStudio Client written in TypeScript
- Host: GitHub
- URL: https://github.com/jakiestfu/stability-ts
- Owner: jakiestfu
- Created: 2022-08-31T18:50:12.000Z (about 2 years ago)
- Default Branch: main
- Last Pushed: 2022-11-29T08:38:51.000Z (almost 2 years ago)
- Last Synced: 2024-10-31T13:33:47.683Z (14 days ago)
- Language: TypeScript
- Size: 147 KB
- Stars: 158
- Watchers: 12
- Forks: 32
- Open Issues: 8
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# Stability TS
A TypeScript client for the Stability AI SDK.[Requires an API Key for DreamStudio which can be found here.](https://beta.dreamstudio.ai/membership)
## Installation
```sh
# NPM
npm i -g stability-ts# To Update
npm update -g stability-ts# Yarn
yarn global add stability-ts
```## Example
```sh
stability \
-s 150 \ # Steps
-c 15 \ # Cfg Scale
-a k_euler_ancestral \ # Diffusion Method
-S 3465383516 \ # Seed
-o ./examples \ # Output Directory
-n 5 \ # 5 images
"a anime still of an highly detailed night cyberpunk city life, bladerunner style!! detailed shops, neon lights, ray tracing, advertising everywhere, people and robots walking around. art by satoshi kon and studio ghibli, in the style of ghost in the shell, muted colours, hyperrealism, cinematic lighting, lush detail, award winning, wlop, octane render, trending on artstation"
```### Output
||||||
|---|---|---|---|---|***
## API
```ts
import { generate } from 'stability-ts'const api = generate({
prompt: 'A Stunning House',
apiKey: process.env.DREAMSTUDIO_API_KEY,
})api.on('image', ({ buffer, filePath }) => {
console.log('Image', buffer, filePath)
})api.on('end', (data) => {
console.log('Generating Complete', data)
})
```Async/Promise API
```ts
import { generateAsync } from 'stability-ts'try {
const { res, images } = await generateAsync({
prompt: 'A Stunning House',
apiKey: process.env.DREAMSTUDIO_API_KEY,
})
console.log(images)
} catch (e) {
// ...
}
```## CLI
```sh
Usage: stability [options] [prompt]Generate an image
Arguments:
prompt The text prompt you want to useOptions:
-V, --version output the version number
-H, --height height of image (default: 512)
-W, --width width of image (default: 512)
-c, --cfg_scale CFG scale factor (default: 7)
-a, --sampler Diffusion Method (choices: "ddim", "plms", "k_euler", "k_euler_ancestral", "k_heun", "k_dpm_2", "k_dpm_2_ancestral", "k_lms", default: "k_lms")
-s, --steps number of steps (default: 50)
-S, --seed random seed to use (default: 1614811539)
-n, --num_samples number of samples to generate (default: 1)
-e, --engine engine to use for inference (default: "stable-diffusion-v1")
--no-store do not write aritfacts to disk
-k, --api-key DreamStudio API Key (env: DREAMSTUDIO_API_KEY)
-o, --output-dir directory to store images (default: "/Users/jacobkelley/code/stability-ts")
-d, --debug Additional logging
-h, --help display help for command
```## Developing
```
nvm use
yarn
yarn buildnpm link
export DREAMSTUDIO_API_KEY=...
stability "A stunning house"
```