Name | stability-sdk JSON |
Version |
0.8.5
JSON |
| download |
home_page | https://beta.dreamstudio.ai/ |
Summary | Python SDK for interacting with stability.ai APIs |
upload_time | 2023-11-20 17:30:04 |
maintainer | Stability AI |
docs_url | None |
author | Stability AI |
requires_python | |
license | MIT |
keywords |
|
VCS |
 |
bugtrack_url |
|
requirements |
No requirements were recorded.
|
Travis-CI |
No Travis.
|
coveralls test coverage |
No coveralls.
|
# stability-sdk
[](https://colab.research.google.com/github/stability-ai/stability-sdk/blob/main/nbs/demo_colab.ipynb)
Client implementations that interact with the Stability API.
## Getting an API key
Follow the [instructions](https://platform.stability.ai/docs/getting-started/authentication) on [Platform](https://platform.stability.ai) to obtain an API key.
## PyPI Package Installation
Install the [PyPI](https://pypi.org/project/stability-sdk/) 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 -e .`
- `pyenv/bin/activate` to use the venv.
- Set the `STABILITY_HOST` environment variable. This is by default set to the production endpoint `grpc.stability.ai:443`.
- Set the `STABILITY_KEY` environment variable.
Then to invoke:
`python3 -m stability_sdk generate -W 1024 -H 1024 "A stunning house."`
It will generate and put PNGs in your current directory.
To upscale:
`python3 -m stability_sdk upscale -i "/path/to/image.png"`
## Animation UI
Install with
`pip install stability-sdk[anim_ui]`
Then run with
`python3 -m stability_sdk animate --gui`
## SDK Usage
Be sure to check out [Platform](https://platform.stability.ai) for comprehensive documentation on how to interact with our API.
## Command line usage
```
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
```
For upscale:
```
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
```
## Connecting to the API using languages other than Python
If a language you would like to connect to the API with is not currently documented on [Platform](https://platform.stability.ai) you can use the following
protobuf definition to compile stubs for your language:
- [protobuf spec](https://github.com/Stability-AI/api-interfaces/blob/main/src/proto/)
## Community-contributed clients
* Typescript client: https://github.com/jakiestfu/stability-ts
* Guide to building for Ruby: https://github.com/kmcphillips/stability-sdk/blob/main/src/ruby/README.md
* C# client: https://github.com/Katarzyna-Kadziolka/StabilityClient.Net
## Stability API TOS
Usage of the Stability API falls under the [STABILITY AI API Terms of Service.
](https://platform.stability.ai/docs/terms-of-service)
Raw data
{
"_id": null,
"home_page": "https://beta.dreamstudio.ai/",
"name": "stability-sdk",
"maintainer": "Stability AI",
"docs_url": null,
"requires_python": "",
"maintainer_email": "support@stability.ai",
"keywords": "",
"author": "Stability AI",
"author_email": "support@stability.ai",
"download_url": "https://files.pythonhosted.org/packages/3a/8b/644e517f4005f77028f967119f7ece63e6c48cfd42feaf6ca96d64e28948/stability-sdk-0.8.5.tar.gz",
"platform": null,
"description": "# stability-sdk\n\n[](https://colab.research.google.com/github/stability-ai/stability-sdk/blob/main/nbs/demo_colab.ipynb)\n\nClient implementations that interact with the Stability API. \n\n## Getting an API key\n\nFollow the [instructions](https://platform.stability.ai/docs/getting-started/authentication) on [Platform](https://platform.stability.ai) to obtain an API key.\n\n## PyPI Package Installation\n\nInstall the [PyPI](https://pypi.org/project/stability-sdk/) package via:\n\n`pip install stability-sdk`\n\n## Python Client\n\n`client.py` is both a command line client and an API class that wraps the gRPC based API. To try the client:\n\n- Use Python venv: `python3 -m venv pyenv`\n- Set up in venv dependencies: `pyenv/bin/pip3 install -e .`\n- `pyenv/bin/activate` to use the venv.\n- Set the `STABILITY_HOST` environment variable. This is by default set to the production endpoint `grpc.stability.ai:443`.\n- Set the `STABILITY_KEY` environment variable.\n\nThen to invoke:\n\n`python3 -m stability_sdk generate -W 1024 -H 1024 \"A stunning house.\"`\n\nIt will generate and put PNGs in your current directory.\n\nTo upscale:\n`python3 -m stability_sdk upscale -i \"/path/to/image.png\"`\n\n## Animation UI\n\nInstall with \n`pip install stability-sdk[anim_ui]`\n\nThen run with \n`python3 -m stability_sdk animate --gui`\n\n## SDK Usage\n\nBe sure to check out [Platform](https://platform.stability.ai) for comprehensive documentation on how to interact with our API.\n\n## Command line usage\n\n```\nusage: python -m stability_sdk generate [-h] [--height HEIGHT] [--width WIDTH] \n [--start_schedule START_SCHEDULE] [--end_schedule END_SCHEDULE] \n [--cfg_scale CFG_SCALE] [--sampler SAMPLER] [--steps STEPS] \n [--style_preset STYLE_PRESET] [--seed SEED] [--prefix PREFIX] [--engine ENGINE]\n [--num_samples NUM_SAMPLES] [--artifact_types ARTIFACT_TYPES]\n [--no-store] [--show] [--init_image INIT_IMAGE] [--mask_image MASK_IMAGE]\n [prompt ...]\n\npositional arguments:\n prompt\n\noptions:\n -h, --help show this help message and exit\n --height HEIGHT, -H HEIGHT\n [1024] height of image\n --width WIDTH, -W WIDTH\n [1024] width of image\n --start_schedule START_SCHEDULE\n [0.5] start schedule for init image (must be greater than 0; 1 is full strength\n text prompt, no trace of image)\n --end_schedule END_SCHEDULE\n [0.01] end schedule for init image\n --cfg_scale CFG_SCALE, -C CFG_SCALE\n [7.0] CFG scale factor\n --sampler SAMPLER, -A SAMPLER\n [auto-select] (ddim, plms, k_euler, k_euler_ancestral, k_heun, k_dpm_2,\n k_dpm_2_ancestral, k_lms, k_dpmpp_2m, k_dpmpp_2s_ancestral)\n --steps STEPS, -s STEPS\n [auto] number of steps\n --style_preset STYLE_PRESET\n [none] (3d-model, analog-film, anime, cinematic, comic-book, digital-art, enhance, \n fantasy-art, isometric, line-art, low-poly, modeling-compound, neon-punk, origami, \n photographic, pixel-art, tile-texture)\n --seed SEED, -S SEED random seed to use\n --prefix PREFIX, -p PREFIX\n output prefixes for artifacts\n --artifact_types ARTIFACT_TYPES, -t ARTIFACT_TYPES\n filter artifacts by type (ARTIFACT_IMAGE, ARTIFACT_TEXT, ARTIFACT_CLASSIFICATIONS, etc)\n --no-store do not write out artifacts\n --num_samples NUM_SAMPLES, -n NUM_SAMPLES\n number of samples to generate\n --show open artifacts using PIL\n --engine ENGINE, -e ENGINE\n engine to use for inference\n --init_image INIT_IMAGE, -i INIT_IMAGE\n Init image\n --mask_image MASK_IMAGE, -m MASK_IMAGE\n Mask image\n```\nFor upscale:\n```\nusage: client.py upscale\n [-h]\n --init_image INIT_IMAGE\n [--height HEIGHT] [--width WIDTH] [--prefix PREFIX] [--artifact_types ARTIFACT_TYPES]\n [--no-store] [--show] [--engine ENGINE]\n\npositional arguments:\n prompt (ignored in esrgan engines)\n\noptions:\n -h, --help show this help message and exit\n --init_image INIT_IMAGE, -i INIT_IMAGE\n Init image\n --height HEIGHT, -H HEIGHT\n height of upscaled image in pixels\n --width WIDTH, -W WIDTH\n width of upscaled image in pixels\n --steps STEPS, -s STEPS\n [auto] number of steps (ignored in esrgan engines)\n --seed SEED, -S SEED random seed to use (ignored in esrgan engines)\n --cfg_scale CFG_SCALE, -C CFG_SCALE\n [7.0] CFG scale factor (ignored in esrgan engines)\n --prefix PREFIX, -p PREFIX\n output prefixes for artifacts\n --artifact_types ARTIFACT_TYPES, -t ARTIFACT_TYPES\n filter artifacts by type (ARTIFACT_IMAGE, ARTIFACT_TEXT, ARTIFACT_CLASSIFICATIONS, etc)\n --no-store do not write out artifacts\n --show open artifacts using PIL\n --engine ENGINE, -e ENGINE\n engine to use for upscale\n \n```\n\n\n## Connecting to the API using languages other than Python\n\nIf a language you would like to connect to the API with is not currently documented on [Platform](https://platform.stability.ai) you can use the following\nprotobuf definition to compile stubs for your language:\n\n- [protobuf spec](https://github.com/Stability-AI/api-interfaces/blob/main/src/proto/)\n\n## Community-contributed clients\n\n* Typescript client: https://github.com/jakiestfu/stability-ts\n* Guide to building for Ruby: https://github.com/kmcphillips/stability-sdk/blob/main/src/ruby/README.md\n* C# client: https://github.com/Katarzyna-Kadziolka/StabilityClient.Net\n\n## Stability API TOS\n\nUsage of the Stability API falls under the [STABILITY AI API Terms of Service.\n](https://platform.stability.ai/docs/terms-of-service)\n",
"bugtrack_url": null,
"license": "MIT",
"summary": "Python SDK for interacting with stability.ai APIs",
"version": "0.8.5",
"project_urls": {
"Download": "https://github.com/Stability-AI/stability-sdk/",
"Homepage": "https://beta.dreamstudio.ai/"
},
"split_keywords": [],
"urls": [
{
"comment_text": "",
"digests": {
"blake2b_256": "4d1d45cd014e1e55d083abf5448f22820bd4c4004579b1166784d50f8fa9af67",
"md5": "bc49b2e5970386535933b33f0cc20148",
"sha256": "6fad23136284446c19b5ae114f94d91cdd497fc1283f4a2f9d4e50f9165aa178"
},
"downloads": -1,
"filename": "stability_sdk-0.8.5-py3-none-any.whl",
"has_sig": false,
"md5_digest": "bc49b2e5970386535933b33f0cc20148",
"packagetype": "bdist_wheel",
"python_version": "py3",
"requires_python": null,
"size": 117137,
"upload_time": "2023-11-20T17:30:02",
"upload_time_iso_8601": "2023-11-20T17:30:02.833205Z",
"url": "https://files.pythonhosted.org/packages/4d/1d/45cd014e1e55d083abf5448f22820bd4c4004579b1166784d50f8fa9af67/stability_sdk-0.8.5-py3-none-any.whl",
"yanked": false,
"yanked_reason": null
},
{
"comment_text": "",
"digests": {
"blake2b_256": "3a8b644e517f4005f77028f967119f7ece63e6c48cfd42feaf6ca96d64e28948",
"md5": "56e237296908c7e769af298624947edb",
"sha256": "a2b2cd10925cd7264616c2deac8594db054607f8902c9f78c133c4ed67db69b5"
},
"downloads": -1,
"filename": "stability-sdk-0.8.5.tar.gz",
"has_sig": false,
"md5_digest": "56e237296908c7e769af298624947edb",
"packagetype": "sdist",
"python_version": "source",
"requires_python": null,
"size": 107234,
"upload_time": "2023-11-20T17:30:04",
"upload_time_iso_8601": "2023-11-20T17:30:04.850257Z",
"url": "https://files.pythonhosted.org/packages/3a/8b/644e517f4005f77028f967119f7ece63e6c48cfd42feaf6ca96d64e28948/stability-sdk-0.8.5.tar.gz",
"yanked": false,
"yanked_reason": null
}
],
"upload_time": "2023-11-20 17:30:04",
"github": true,
"gitlab": false,
"bitbucket": false,
"codeberg": false,
"github_user": "Stability-AI",
"github_project": "stability-sdk",
"travis_ci": false,
"coveralls": false,
"github_actions": true,
"lcname": "stability-sdk"
}