(generate)
Operations related to AI generate api
- text_to_image - Text To Image
- image_to_image - Image To Image
- image_to_video - Image To Video
- upscale - Upscale
- audio_to_text - Audio To Text
- segment_anything2 - Segment Anything 2
Generate images from text prompts.
from livepeer import Livepeer
s = Livepeer(
api_key="<YOUR_BEARER_TOKEN_HERE>",
)
res = s.generate.text_to_image(request={
"prompt": "<value>",
})
if res.image_response is not None:
# handle response
pass
Parameter | Type | Required | Description |
---|---|---|---|
request |
components.TextToImageParams | ✔️ | The request object to use for the request. |
retries |
Optional[utils.RetryConfig] | ➖ | Configuration to override the default retry behavior of the client. |
operations.GenTextToImageResponse
Error Object | Status Code | Content Type |
---|---|---|
errors.GenTextToImageResponseBody | 400 | application/json |
errors.GenTextToImageGenerateResponseBody | 401 | application/json |
errors.GenTextToImageGenerateResponseResponseBody | 422 | application/json |
errors.GenTextToImageGenerateResponse500ResponseBody | 500 | application/json |
errors.SDKError | 4xx-5xx | / |
Apply image transformations to a provided image.
from livepeer import Livepeer
s = Livepeer(
api_key="<YOUR_BEARER_TOKEN_HERE>",
)
res = s.generate.image_to_image(request={
"prompt": "<value>",
"image": {
"file_name": "example.file",
"content": open("example.file", "rb"),
},
})
if res.image_response is not None:
# handle response
pass
Parameter | Type | Required | Description |
---|---|---|---|
request |
components.BodyGenImageToImage | ✔️ | The request object to use for the request. |
retries |
Optional[utils.RetryConfig] | ➖ | Configuration to override the default retry behavior of the client. |
operations.GenImageToImageResponse
Error Object | Status Code | Content Type |
---|---|---|
errors.GenImageToImageResponseBody | 400 | application/json |
errors.GenImageToImageGenerateResponseBody | 401 | application/json |
errors.GenImageToImageGenerateResponseResponseBody | 422 | application/json |
errors.GenImageToImageGenerateResponse500ResponseBody | 500 | application/json |
errors.SDKError | 4xx-5xx | / |
Generate a video from a provided image.
from livepeer import Livepeer
s = Livepeer(
api_key="<YOUR_BEARER_TOKEN_HERE>",
)
res = s.generate.image_to_video(request={
"image": {
"file_name": "example.file",
"content": open("example.file", "rb"),
},
})
if res.video_response is not None:
# handle response
pass
Parameter | Type | Required | Description |
---|---|---|---|
request |
components.BodyGenImageToVideo | ✔️ | The request object to use for the request. |
retries |
Optional[utils.RetryConfig] | ➖ | Configuration to override the default retry behavior of the client. |
operations.GenImageToVideoResponse
Error Object | Status Code | Content Type |
---|---|---|
errors.GenImageToVideoResponseBody | 400 | application/json |
errors.GenImageToVideoGenerateResponseBody | 401 | application/json |
errors.GenImageToVideoGenerateResponseResponseBody | 422 | application/json |
errors.GenImageToVideoGenerateResponse500ResponseBody | 500 | application/json |
errors.SDKError | 4xx-5xx | / |
Upscale an image by increasing its resolution.
from livepeer import Livepeer
s = Livepeer(
api_key="<YOUR_BEARER_TOKEN_HERE>",
)
res = s.generate.upscale(request={
"prompt": "<value>",
"image": {
"file_name": "example.file",
"content": open("example.file", "rb"),
},
})
if res.image_response is not None:
# handle response
pass
Parameter | Type | Required | Description |
---|---|---|---|
request |
components.BodyGenUpscale | ✔️ | The request object to use for the request. |
retries |
Optional[utils.RetryConfig] | ➖ | Configuration to override the default retry behavior of the client. |
Error Object | Status Code | Content Type |
---|---|---|
errors.GenUpscaleResponseBody | 400 | application/json |
errors.GenUpscaleGenerateResponseBody | 401 | application/json |
errors.GenUpscaleGenerateResponseResponseBody | 422 | application/json |
errors.GenUpscaleGenerateResponse500ResponseBody | 500 | application/json |
errors.SDKError | 4xx-5xx | / |
Transcribe audio files to text.
from livepeer import Livepeer
s = Livepeer(
api_key="<YOUR_BEARER_TOKEN_HERE>",
)
res = s.generate.audio_to_text(request={
"audio": {
"file_name": "example.file",
"content": open("example.file", "rb"),
},
})
if res.text_response is not None:
# handle response
pass
Parameter | Type | Required | Description |
---|---|---|---|
request |
components.BodyGenAudioToText | ✔️ | The request object to use for the request. |
retries |
Optional[utils.RetryConfig] | ➖ | Configuration to override the default retry behavior of the client. |
operations.GenAudioToTextResponse
Error Object | Status Code | Content Type |
---|---|---|
errors.GenAudioToTextResponseBody | 400 | application/json |
errors.GenAudioToTextGenerateResponseBody | 401 | application/json |
errors.GenAudioToTextGenerateResponseResponseBody | 413 | application/json |
errors.GenAudioToTextGenerateResponse422ResponseBody | 422 | application/json |
errors.GenAudioToTextGenerateResponse500ResponseBody | 500 | application/json |
errors.SDKError | 4xx-5xx | / |
Segment objects in an image.
from livepeer import Livepeer
s = Livepeer(
api_key="<YOUR_BEARER_TOKEN_HERE>",
)
res = s.generate.segment_anything2(request={
"image": {
"file_name": "example.file",
"content": open("example.file", "rb"),
},
})
if res.masks_response is not None:
# handle response
pass
Parameter | Type | Required | Description |
---|---|---|---|
request |
components.BodyGenSegmentAnything2 | ✔️ | The request object to use for the request. |
retries |
Optional[utils.RetryConfig] | ➖ | Configuration to override the default retry behavior of the client. |
operations.GenSegmentAnything2Response
Error Object | Status Code | Content Type |
---|---|---|
errors.GenSegmentAnything2ResponseBody | 400 | application/json |
errors.GenSegmentAnything2GenerateResponseBody | 401 | application/json |
errors.GenSegmentAnything2GenerateResponseResponseBody | 422 | application/json |
errors.GenSegmentAnything2GenerateResponse500ResponseBody | 500 | application/json |
errors.SDKError | 4xx-5xx | / |