稳定性-SDK
与稳定性API相互作用的客户实现。
获取API键
按照平台上的说明获取API密钥。
PYPI软件包安装
通过以下方式安装PYPI软件包:
PIP安装稳定性SDK
Python客户端
Client.py既是命令行客户端,也是包装基于GRPC的API的API类。尝试客户:
- 使用Python Venv:Python3 -M Venv Pyenv
- 在VENV依赖项中设置:pyenv/bin/pip3安装-e。
- pyenv/bin/激活以使用VENV。
- 设置stemability_host环境变量。默认情况下,将设置为生产端点grpc.stobility.ai:443。
- 设置stemability_key环境变量。
然后调用:
python3 -m稳定性_sdk生成-W 1024 -H 1024“一个令人惊叹的房子”。
它将生成并将PNG放入您的当前目录中。
到高档:python3 -m styability_sdk upscale -i“/path/to/image.png”
动画UI
使用PIP安装安装稳定性SDK [anim_ui]
然后使用python3 -m styability_sdk Animate -gui运行
SDK用法
请务必查看平台以获取有关如何与我们的API互动的全面文档。
命令行的用法
usage: python -m stability_sdk generate [-h] [--height HEIGHT] [--width WIDTH]
[--start_schedule START_SCHEDULE] [--end_schedule END_SCHEDULE]
[--cfg_scale CFG_SCALE] [--sampler SAMPLER] [--steps STEPS]
[--style_preset STYLE_PRESET] [--seed SEED] [--prefix PREFIX] [--engine ENGINE]
[--num_samples NUM_SAMPLES] [--artifact_types ARTIFACT_TYPES]
[--no-store] [--show] [--init_image INIT_IMAGE] [--mask_image MASK_IMAGE]
[prompt ...]
positional arguments:
prompt
options:
-h, --help show this help message and exit
--height HEIGHT, -H HEIGHT
[1024] height of image
--width WIDTH, -W WIDTH
[1024] width of image
--start_schedule START_SCHEDULE
[0.5] start schedule for init image (must be greater than 0; 1 is full strength
text prompt, no trace of image)
--end_schedule END_SCHEDULE
[0.01] end schedule for init image
--cfg_scale CFG_SCALE, -C CFG_SCALE
[7.0] CFG scale factor
--sampler SAMPLER, -A SAMPLER
[auto-select] (ddim, plms, k_euler, k_euler_ancestral, k_heun, k_dpm_2,
k_dpm_2_ancestral, k_lms, k_dpmpp_2m, k_dpmpp_2s_ancestral)
--steps STEPS, -s STEPS
[auto] number of steps
--style_preset STYLE_PRESET
[none] (3d-model, analog-film, anime, cinematic, comic-book, digital-art, enhance,
fantasy-art, isometric, line-art, low-poly, modeling-compound, neon-punk, origami,
photographic, pixel-art, tile-texture)
--seed SEED, -S SEED random seed to use
--prefix PREFIX, -p PREFIX
output prefixes for artifacts
--artifact_types ARTIFACT_TYPES, -t ARTIFACT_TYPES
filter artifacts by type (ARTIFACT_IMAGE, ARTIFACT_TEXT, ARTIFACT_CLASSIFICATIONS, etc)
--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 ENGINE, -e ENGINE
engine to use for inference
--init_image INIT_IMAGE, -i INIT_IMAGE
Init image
--mask_image MASK_IMAGE, -m MASK_IMAGE
Mask image
高档:
usage: client.py upscale
[-h]
--init_image INIT_IMAGE
[--height HEIGHT] [--width WIDTH] [--prefix PREFIX] [--artifact_types ARTIFACT_TYPES]
[--no-store] [--show] [--engine ENGINE]
positional arguments:
prompt (ignored in esrgan engines)
options:
-h, --help show this help message and exit
--init_image INIT_IMAGE, -i INIT_IMAGE
Init image
--height HEIGHT, -H HEIGHT
height of upscaled image in pixels
--width WIDTH, -W WIDTH
width of upscaled image in pixels
--steps STEPS, -s STEPS
[auto] number of steps (ignored in esrgan engines)
--seed SEED, -S SEED random seed to use (ignored in esrgan engines)
--cfg_scale CFG_SCALE, -C CFG_SCALE
[7.0] CFG scale factor (ignored in esrgan engines)
--prefix PREFIX, -p PREFIX
output prefixes for artifacts
--artifact_types ARTIFACT_TYPES, -t ARTIFACT_TYPES
filter artifacts by type (ARTIFACT_IMAGE, ARTIFACT_TEXT, ARTIFACT_CLASSIFICATIONS, etc)
--no-store do not write out artifacts
--show open artifacts using PIL
--engine ENGINE, -e ENGINE
engine to use for upscale
使用Python以外的其他语言连接API
如果您想将一种语言连接到API,目前尚未在平台上记录您,则可以使用以下Protobuf定义来编译语言的存根:
- Protobuf规格
社区成立的客户
- Typescript客户端:https://github.com/jakiestfu/stobility-ts
- Ruby建筑物指南:https://github.com/kmcphillips/stobilitional-sdk/blob/main/main/src/ruby/readme.md
- C#客户端:https://github.com/katarzyna-kadziolka/stabilityclient.net
稳定性API TOS
稳定性API的使用属于稳定性AI API服务条款。
