Python SDK for interacting with stability.ai APIs
Project description
stability-clients
Client implementations that interact with the Stability Generator API
Installation
Install the PyPI package via:
pip install stability-sdk
Python client
client.py
is both a command line client and an API class that wraps the gRPC based API. To try the client:
- Use Python venv:
python3 -m venv pyenv
- Set up in venv dependencies:
pyenv/bin/pip3 install -r requirements.txt
pyenv/bin/activate
to use the venv.- Set the
STABILITY_HOST
environment variable. This is by default set to the production endpointgrpc.stability.ai:443
. - Set the
STABILITY_KEY
environment variable.
Then to invoke:
python3 client.py -W 512 -H 512 "A stunning house."
It will generate and put PNGs in your current directory.
SDK Usage
See usage demo notebooks in ./nbs
Command line usage
usage: python -m stability_sdk.client [-h] [--height HEIGHT] [--width WIDTH]
[--cfg_scale CFG_SCALE] [--sampler SAMPLER] [--steps STEPS]
[--seed SEED] [--prefix PREFIX] [--no-store]
[--num_samples NUM_SAMPLES] [--show]
prompt [prompt ...]
positional arguments:
prompt
optional arguments:
-h, --help show this help message and exit
--height HEIGHT, -H HEIGHT
[512] height of image
--width WIDTH, -W WIDTH
[512] width of image
--cfg_scale CFG_SCALE, -C CFG_SCALE
[7.0] CFG scale factor
--sampler SAMPLER, -A SAMPLER
[k_lms] (ddim, plms, k_euler, k_euler_ancestral,
k_heun, k_dpm_2, k_dpm_2_ancestral, k_lms)
--steps STEPS, -s STEPS
[50] number of steps
--seed SEED, -S SEED random seed to use
--prefix PREFIX, -p PREFIX
output prefixes for artifacts
--no-store do not write out artifacts
--num_samples NUM_SAMPLES, -n NUM_SAMPLES
number of samples to generate
--show open artifacts using PIL
--engine, -e engine to use for inference
Connecting to the API in using langauges other than python
The src
subdirectory contains pre-compiled gRPC stubs for the following languages:
If a language you would like to connect to the API with is not listed above, you can use the following protobuf definition to compile stubs for your language:
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
stability-sdk-0.2.3.tar.gz
(13.4 kB
view hashes)
Built Distribution
Close
Hashes for stability_sdk-0.2.3-py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 0d7cc15f65ebe8d7de91f910d2549cb0574928d867ad1e965240cec9b5916f82 |
|
MD5 | 7e931db87d620be7707ed325bfd06adf |
|
BLAKE2b-256 | 7a262509b18e6bff34941eccdd7b6de2b253b1aa56e6488604eb0a70a4e279dd |