Stability-AI / stability-sdk

SDK for interacting with stability.ai APIs (e.g. stable diffusion inference)
https://platform.stability.ai/
MIT License
2.42k stars 336 forks source link

Upscale #186

Closed enzymezoo-code closed 1 year ago

enzymezoo-code commented 1 year ago

Upscaler added to client

Notable change:

Command line call has been modified! From:

python -m stability_sdk ...

to

python -m stability_sdk generate ...
python -m stability_sdk upscale ...

Backwards compatibility has been (mostly) maintained with a hack here: https://github.com/Stability-AI/stability-sdk/blob/9c297554fea7ffcd3af90ac3c0c1dc2039987c87/src/stability_sdk/client.py#L529

Usage

The client is initialized with an upscale_engine (default "esrgan-v1-x2plus"). As illustrated in the notebook, the upscaler can be invoked with:

answers = stability_api.upscale(
    init_image=img
)

Default output image size depends on the upscale_engine (x2 for esrgan-v1-x2plus). Optionally, a height or width can be requested to specify output size:

answers = stability_api.upscale(
    init_image=img,
    width=1000
)

Do not specify both a height and width, only specify one or neither. This is to preserve the aspect ratio of the original image.

enzymezoo-code commented 1 year ago

TODO before merge:

sonarcloud[bot] commented 1 year ago

Kudos, SonarCloud Quality Gate passed!    Quality Gate passed

Bug A 0 Bugs
Vulnerability A 0 Vulnerabilities
Security Hotspot A 0 Security Hotspots
Code Smell A 0 Code Smells

No Coverage information No Coverage information
0.0% 0.0% Duplication