Name | runware JSON |
Version |
0.1.3
JSON |
| download |
home_page | https://github.com/runware/sdk-python |
Summary | 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. |
upload_time | 2024-05-01 18:40:23 |
maintainer | None |
docs_url | None |
author | Runware Inc. |
requires_python | >=3.10 |
license | MIT |
keywords |
runware
stable diffusion
text to image
image to text
|
VCS |
|
bugtrack_url |
|
requirements |
No requirements were recorded.
|
Travis-CI |
No Travis.
|
coveralls test coverage |
No coveralls.
|
# Python Runware SDK
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.
## Get API Access
To use the Python Runware SDK, you need to obtain an API key. Follow these steps to get API access:
1. [Create a free account](https://my.runware.ai/) with [Runware](https://runware.ai/).
2. Once you have created an account, you will receive an API key and trial credits.
**Important**: Please keep your API key private and do not share it with anyone. Treat it as a sensitive credential.
## Documentation
For detailed documentation and API reference, please visit the [Runware Documentation](https://docs.runware.ai/) or refer to the [docs](docs) folder in the repository. The documentation provides comprehensive information about the available classes, methods, and parameters, along with code examples to help you get started with the Runware SDK Python.
## Installation
To install the Python Runware SDK, use the following command:
```bash
pip install runware
```
## 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:
```bash
RUNWARE_API_KEY = "your_api_key_here"
```
### Generating Images
To generate images using the Runware API, you can use the `requestImages` method of the `Runware` class. Here's an example:
```python
from runware import Runware, IRequestImage
async def main() -> None:
runware = Runware(api_key=RUNWARE_API_KEY)
await runware.connect()
request_image = IRequestImage(
positive_prompt="A beautiful sunset over the mountains",
image_size=1,
model_id=13,
number_of_images=5,
negative_prompt="cloudy, rainy",
use_cache=False,
)
images = await runware.requestImages(requestImage=request_image)
for image in images:
print(f"Image URL: {image.imageSrc}")
```
### Enhancing Prompts
To enhance prompts using the Runware API, you can use the `enhancePrompt` method of the `Runware` class. Here's an example:
```python
from runware import Runware, IPromptEnhancer
async def main() -> None:
runware = Runware(api_key=RUNWARE_API_KEY)
await runware.connect()
prompt = "A beautiful sunset over the mountains"
prompt_enhancer = IPromptEnhancer(
prompt=prompt,
prompt_versions=3,
)
enhanced_prompts = await runware.enhancePrompt(promptEnhancer=prompt_enhancer)
for enhanced_prompt in enhanced_prompts:
print(enhanced_prompt.text)
```
### Removing Image Background
To remove the background from an image using the Runware API, you can use the `removeImageBackground` method of the `Runware` class. Here's an example:
```python
from runware import Runware, IRemoveImageBackground
async def main() -> None:
runware = Runware(api_key=RUNWARE_API_KEY)
await runware.connect()
image_path = "image.jpg"
remove_image_background_payload = IRemoveImageBackground(image_initiator=image_path)
processed_images = await runware.removeImageBackground(
removeImageBackgroundPayload=remove_image_background_payload
)
for image in processed_images:
print(image.imageSrc)
```
### Image-to-Text Conversion
To convert an image to text using the Runware API, you can use the `requestImageToText` method of the `Runware` class. Here's an example:
```python
from runware import Runware, IRequestImageToText
async def main() -> None:
runware = Runware(api_key=RUNWARE_API_KEY)
await runware.connect()
image_path = "image.jpg"
request_image_to_text_payload = IRequestImageToText(image_initiator=image_path)
image_to_text = await runware.requestImageToText(
requestImageToText=request_image_to_text_payload
)
print(image_to_text.text)
```
### Upscaling Images
To upscale an image using the Runware API, you can use the `upscaleGan` method of the `Runware` class. Here's an example:
```python
from runware import Runware, IUpscaleGan
async def main() -> None:
runware = Runware(api_key=RUNWARE_API_KEY)
await runware.connect()
image_path = "image.jpg"
upscale_factor = 4
upscale_gan_payload = IUpscaleGan(
image_initiator=image_path, upscale_factor=upscale_factor
)
upscaled_images = await runware.upscaleGan(upscaleGanPayload=upscale_gan_payload)
for image in upscaled_images:
print(image.imageSrc)
```
For more detailed usage and additional examples, please refer to the examples directory.
Raw data
{
"_id": null,
"home_page": "https://github.com/runware/sdk-python",
"name": "runware",
"maintainer": null,
"docs_url": null,
"requires_python": ">=3.10",
"maintainer_email": null,
"keywords": "Runware, stable diffusion, text to image, image to text",
"author": "Runware Inc.",
"author_email": "python.sdk@runware.ai",
"download_url": "https://files.pythonhosted.org/packages/24/74/a01e98e4be5c204ff39f088f6d67babdd2299e22f0bdad50d4e27b36cac2/runware-0.1.3.tar.gz",
"platform": null,
"description": "# Python Runware SDK\n\nThe 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.\n\n## Get API Access\n\nTo use the Python Runware SDK, you need to obtain an API key. Follow these steps to get API access:\n\n1. [Create a free account](https://my.runware.ai/) with [Runware](https://runware.ai/).\n2. Once you have created an account, you will receive an API key and trial credits.\n\n**Important**: Please keep your API key private and do not share it with anyone. Treat it as a sensitive credential.\n\n## Documentation\n\nFor detailed documentation and API reference, please visit the [Runware Documentation](https://docs.runware.ai/) or refer to the [docs](docs) folder in the repository. The documentation provides comprehensive information about the available classes, methods, and parameters, along with code examples to help you get started with the Runware SDK Python.\n\n## Installation\n\nTo install the Python Runware SDK, use the following command:\n\n```bash\npip install runware\n```\n\n## Usage\n\nBefore 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:\n\n```bash\nRUNWARE_API_KEY = \"your_api_key_here\"\n```\n\n### Generating Images\n\nTo generate images using the Runware API, you can use the `requestImages` method of the `Runware` class. Here's an example:\n\n```python\nfrom runware import Runware, IRequestImage\n\nasync def main() -> None:\n runware = Runware(api_key=RUNWARE_API_KEY)\n await runware.connect()\n\n request_image = IRequestImage(\n positive_prompt=\"A beautiful sunset over the mountains\",\n image_size=1,\n model_id=13,\n number_of_images=5,\n negative_prompt=\"cloudy, rainy\",\n use_cache=False,\n )\n\n images = await runware.requestImages(requestImage=request_image)\n for image in images:\n print(f\"Image URL: {image.imageSrc}\")\n```\n\n### Enhancing Prompts\n\nTo enhance prompts using the Runware API, you can use the `enhancePrompt` method of the `Runware` class. Here's an example:\n\n```python\nfrom runware import Runware, IPromptEnhancer\n\nasync def main() -> None:\n runware = Runware(api_key=RUNWARE_API_KEY)\n await runware.connect()\n\n prompt = \"A beautiful sunset over the mountains\"\n prompt_enhancer = IPromptEnhancer(\n prompt=prompt,\n prompt_versions=3,\n )\n\n enhanced_prompts = await runware.enhancePrompt(promptEnhancer=prompt_enhancer)\n for enhanced_prompt in enhanced_prompts:\n print(enhanced_prompt.text)\n```\n\n### Removing Image Background\n\nTo remove the background from an image using the Runware API, you can use the `removeImageBackground` method of the `Runware` class. Here's an example:\n\n```python\nfrom runware import Runware, IRemoveImageBackground\n\nasync def main() -> None:\n runware = Runware(api_key=RUNWARE_API_KEY)\n await runware.connect()\n\n image_path = \"image.jpg\"\n remove_image_background_payload = IRemoveImageBackground(image_initiator=image_path)\n\n processed_images = await runware.removeImageBackground(\n removeImageBackgroundPayload=remove_image_background_payload\n )\n for image in processed_images:\n print(image.imageSrc)\n```\n\n### Image-to-Text Conversion\n\nTo convert an image to text using the Runware API, you can use the `requestImageToText` method of the `Runware` class. Here's an example:\n\n```python\nfrom runware import Runware, IRequestImageToText\n\nasync def main() -> None:\n runware = Runware(api_key=RUNWARE_API_KEY)\n await runware.connect()\n\n image_path = \"image.jpg\"\n request_image_to_text_payload = IRequestImageToText(image_initiator=image_path)\n\n image_to_text = await runware.requestImageToText(\n requestImageToText=request_image_to_text_payload\n )\n print(image_to_text.text)\n```\n\n### Upscaling Images\n\nTo upscale an image using the Runware API, you can use the `upscaleGan` method of the `Runware` class. Here's an example:\n\n```python\nfrom runware import Runware, IUpscaleGan\n\nasync def main() -> None:\n runware = Runware(api_key=RUNWARE_API_KEY)\n await runware.connect()\n\n image_path = \"image.jpg\"\n upscale_factor = 4\n\n upscale_gan_payload = IUpscaleGan(\n image_initiator=image_path, upscale_factor=upscale_factor\n )\n upscaled_images = await runware.upscaleGan(upscaleGanPayload=upscale_gan_payload)\n for image in upscaled_images:\n print(image.imageSrc)\n```\n\nFor more detailed usage and additional examples, please refer to the examples directory.\n",
"bugtrack_url": null,
"license": "MIT",
"summary": "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.",
"version": "0.1.3",
"project_urls": {
"Changes": "https://github.com/runware/sdk-python/releases",
"Code": "https://github.com/runware/sdk-python",
"Documentation": "https://docs.runware.ai/",
"Homepage": "https://github.com/runware/sdk-python",
"Issue tracker": "https://github.com/runware/sdk-python/issues"
},
"split_keywords": [
"runware",
" stable diffusion",
" text to image",
" image to text"
],
"urls": [
{
"comment_text": "",
"digests": {
"blake2b_256": "44cc31fa1c2ff546a4c93bae0345cd4bd325f4ed3e24a9360690030483fc211a",
"md5": "d2c06418b71e70d267ba248c5fd9df83",
"sha256": "6b5f6912c4f38b7df154dc780dee9882ad24129c944ff93b182974296bc14ca5"
},
"downloads": -1,
"filename": "runware-0.1.3-py3-none-any.whl",
"has_sig": false,
"md5_digest": "d2c06418b71e70d267ba248c5fd9df83",
"packagetype": "bdist_wheel",
"python_version": "py3",
"requires_python": ">=3.10",
"size": 28744,
"upload_time": "2024-05-01T18:40:21",
"upload_time_iso_8601": "2024-05-01T18:40:21.957570Z",
"url": "https://files.pythonhosted.org/packages/44/cc/31fa1c2ff546a4c93bae0345cd4bd325f4ed3e24a9360690030483fc211a/runware-0.1.3-py3-none-any.whl",
"yanked": false,
"yanked_reason": null
},
{
"comment_text": "",
"digests": {
"blake2b_256": "2474a01e98e4be5c204ff39f088f6d67babdd2299e22f0bdad50d4e27b36cac2",
"md5": "6147967fe2d96c0cbbd7d03dc22b2269",
"sha256": "2b97e2f81839ca4ee889d456a209251459b19bca0ca95fc7a4efe70cf79e4e67"
},
"downloads": -1,
"filename": "runware-0.1.3.tar.gz",
"has_sig": false,
"md5_digest": "6147967fe2d96c0cbbd7d03dc22b2269",
"packagetype": "sdist",
"python_version": "source",
"requires_python": ">=3.10",
"size": 27455,
"upload_time": "2024-05-01T18:40:23",
"upload_time_iso_8601": "2024-05-01T18:40:23.155379Z",
"url": "https://files.pythonhosted.org/packages/24/74/a01e98e4be5c204ff39f088f6d67babdd2299e22f0bdad50d4e27b36cac2/runware-0.1.3.tar.gz",
"yanked": false,
"yanked_reason": null
}
],
"upload_time": "2024-05-01 18:40:23",
"github": true,
"gitlab": false,
"bitbucket": false,
"codeberg": false,
"github_user": "runware",
"github_project": "sdk-python",
"travis_ci": false,
"coveralls": false,
"github_actions": true,
"requirements": [],
"lcname": "runware"
}