Python Library
Introduction
The Python Runware SDK is used to run image inference with the Runware API, powered by the Runware inference platform. It can be used to generate imaged with text-to-image and image-to-image. It also allows the use of an existing gallery of models or selecting any model or LoRA from the CivitAI gallery. The API also supports upscaling, background removal, inpainting and outpainting, and a series of other ControlNet models.
Installation
To install the Python Runware SDK, use the following command:
Usage
Before using the Python Runware SDK, make sure to set your Runware API key in the environment variable RUNWARE_API_KEY
. You can do this by creating a .env
file in your project root and adding the following line:
Generating Images
To generate images using the Runware API, you can use the imageInference
method of the Runware
class. Here's an example:
Enhancing Prompts
To enhance prompts using the Runware API, you can use the promptEnhance
method of the Runware
class. Here's an example:
Removing Image Background
To remove the background from an image using the Runware API, you can use the imageBackgroundRemoval
method of the Runware
class. Here's an example:
Image-to-Text Conversion
To convert an image to text using the Runware API, you can use the imageCaption
method of the Runware
class. Here's an example:
Upscaling Images
To upscale an image using the Runware API, you can use the imageUpscale
method of the Runware
class. Here's an example:
Photo Maker
Use the photoMaker
method of the Runware
class. Here's an example:
Generating Images with refiner
To generate images using the Runware API with refiner support, you can use the imageInference
method of the Runware
class. Here's an example: