Introduction to stability-sdk
The stability-sdk project provides client implementations designed to interact with the Stability API. This powerful toolset is invaluable for developers looking to integrate Stability’s features into their applications with ease.
Getting Started
To begin using stability-sdk, the first step is to acquire an API key. This can be done by following the straightforward instructions available on the Stability Platform.
Installation
To install the stability-sdk package, the simplest method is through PyPI. By executing the command pip install stability-sdk
, the package will be added to your Python environment, making it ready for immediate use.
Python Client
For those familiar with Python, the client.py
is an essential tool. It serves as both a command-line client and an API class wrapping the gRPC based API. To utilize the client, users should:
- Create a Python virtual environment using
python3 -m venv pyenv
. - Install dependencies within this virtual environment with
pyenv/bin/pip3 install -e .
. - Activate the environment by running
pyenv/bin/activate
. - Set necessary environment variables:
STABILITY_HOST
andSTABILITY_KEY
.
Once set up, one can generate images by running:
python3 -m stability_sdk generate -W 1024 -H 1024 "A stunning house."
This command generates PNG images in the current directory. For image upscaling, use:
python3 -m stability_sdk upscale -i "/path/to/image.png"
Animation UI
The project also includes a neat interface for animations. Install it with:
pip install stability-sdk[anim_ui]
Run the animation interface by executing:
python3 -m stability_sdk animate --gui
SDK and Command Line Usage
For comprehensive usage of the SDK, developers are encouraged to explore the extensive documentation provided on the Stability Platform. The project allows a wide range of operations from basic image generation to more customized command line tasks, offering options like image dimensions, style presets, and more.
Using Other Programming Languages
While the main client is for Python, the project provides guidance for connecting the API using other languages. Proto files are available for compiling stubs, and there are community-contributed clients for languages such as Typescript, Ruby, and C#.
Terms of Service
It's important to note that using the Stability API is governed by its Terms of Service.
In summary, the stability-sdk is a versatile and powerful tool for integrating Stability’s robust features into various applications, providing both flexibility and ease of use for developers across multiple programming environments.