(generate)
Generate images from text prompts.
from livepeer_ai import Livepeer
with Livepeer(
http_bearer="<YOUR_BEARER_TOKEN_HERE>",
) as livepeer:
res = livepeer.generate.text_to_image(request={
"prompt": "<value>",
})
assert res.image_response is not None
# Handle response
print(res.image_response)
operations.GenTextToImageResponse
Error Type |
Status Code |
Content Type |
errors.HTTPError |
400, 401, 500 |
application/json |
errors.HTTPValidationError |
422 |
application/json |
errors.SDKError |
4XX, 5XX |
*/* |
Apply image transformations to a provided image.
from livepeer_ai import Livepeer
with Livepeer(
http_bearer="<YOUR_BEARER_TOKEN_HERE>",
) as livepeer:
res = livepeer.generate.image_to_image(request={
"prompt": "<value>",
"image": {
"file_name": "example.file",
"content": open("example.file", "rb"),
},
})
assert res.image_response is not None
# Handle response
print(res.image_response)
operations.GenImageToImageResponse
Error Type |
Status Code |
Content Type |
errors.HTTPError |
400, 401, 500 |
application/json |
errors.HTTPValidationError |
422 |
application/json |
errors.SDKError |
4XX, 5XX |
*/* |
Generate a video from a provided image.
from livepeer_ai import Livepeer
with Livepeer(
http_bearer="<YOUR_BEARER_TOKEN_HERE>",
) as livepeer:
res = livepeer.generate.image_to_video(request={
"image": {
"file_name": "example.file",
"content": open("example.file", "rb"),
},
})
assert res.video_response is not None
# Handle response
print(res.video_response)
operations.GenImageToVideoResponse
Error Type |
Status Code |
Content Type |
errors.HTTPError |
400, 401, 500 |
application/json |
errors.HTTPValidationError |
422 |
application/json |
errors.SDKError |
4XX, 5XX |
*/* |
Upscale an image by increasing its resolution.
from livepeer_ai import Livepeer
with Livepeer(
http_bearer="<YOUR_BEARER_TOKEN_HERE>",
) as livepeer:
res = livepeer.generate.upscale(request={
"prompt": "<value>",
"image": {
"file_name": "example.file",
"content": open("example.file", "rb"),
},
})
assert res.image_response is not None
# Handle response
print(res.image_response)
operations.GenUpscaleResponse
Error Type |
Status Code |
Content Type |
errors.HTTPError |
400, 401, 500 |
application/json |
errors.HTTPValidationError |
422 |
application/json |
errors.SDKError |
4XX, 5XX |
*/* |
Transcribe audio files to text.
from livepeer_ai import Livepeer
with Livepeer(
http_bearer="<YOUR_BEARER_TOKEN_HERE>",
) as livepeer:
res = livepeer.generate.audio_to_text(request={
"audio": {
"file_name": "example.file",
"content": open("example.file", "rb"),
},
})
assert res.text_response is not None
# Handle response
print(res.text_response)
operations.GenAudioToTextResponse
Error Type |
Status Code |
Content Type |
errors.HTTPError |
400, 401, 413, 415, 500 |
application/json |
errors.HTTPValidationError |
422 |
application/json |
errors.SDKError |
4XX, 5XX |
*/* |
Segment objects in an image.
from livepeer_ai import Livepeer
with Livepeer(
http_bearer="<YOUR_BEARER_TOKEN_HERE>",
) as livepeer:
res = livepeer.generate.segment_anything2(request={
"image": {
"file_name": "example.file",
"content": open("example.file", "rb"),
},
})
assert res.masks_response is not None
# Handle response
print(res.masks_response)
operations.GenSegmentAnything2Response
Error Type |
Status Code |
Content Type |
errors.HTTPError |
400, 401, 500 |
application/json |
errors.HTTPValidationError |
422 |
application/json |
errors.SDKError |
4XX, 5XX |
*/* |
Generate text using a language model.
from livepeer_ai import Livepeer
with Livepeer(
http_bearer="<YOUR_BEARER_TOKEN_HERE>",
) as livepeer:
res = livepeer.generate.llm(request={
"messages": [
{
"role": "<value>",
"content": "<value>",
},
],
})
assert res.llm_response is not None
# Handle response
print(res.llm_response)
operations.GenLLMResponse
Error Type |
Status Code |
Content Type |
errors.HTTPError |
400, 401, 500 |
application/json |
errors.HTTPValidationError |
422 |
application/json |
errors.SDKError |
4XX, 5XX |
*/* |
Transform image files to text.
from livepeer_ai import Livepeer
with Livepeer(
http_bearer="<YOUR_BEARER_TOKEN_HERE>",
) as livepeer:
res = livepeer.generate.image_to_text(request={
"image": {
"file_name": "example.file",
"content": open("example.file", "rb"),
},
})
assert res.image_to_text_response is not None
# Handle response
print(res.image_to_text_response)
operations.GenImageToTextResponse
Error Type |
Status Code |
Content Type |
errors.HTTPError |
400, 401, 413, 500 |
application/json |
errors.HTTPValidationError |
422 |
application/json |
errors.SDKError |
4XX, 5XX |
*/* |
Apply transformations to a live video streamed to the returned endpoints.
from livepeer_ai import Livepeer
with Livepeer(
http_bearer="<YOUR_BEARER_TOKEN_HERE>",
) as livepeer:
res = livepeer.generate.live_video_to_video(request={
"subscribe_url": "https://soulful-lava.org/",
"publish_url": "https://vain-tabletop.biz",
})
assert res.live_video_to_video_response is not None
# Handle response
print(res.live_video_to_video_response)
operations.GenLiveVideoToVideoResponse
Error Type |
Status Code |
Content Type |
errors.HTTPError |
400, 401, 500 |
application/json |
errors.HTTPValidationError |
422 |
application/json |
errors.SDKError |
4XX, 5XX |
*/* |
Generate a text-to-speech audio file based on the provided text input and speaker description.
from livepeer_ai import Livepeer
with Livepeer(
http_bearer="<YOUR_BEARER_TOKEN_HERE>",
) as livepeer:
res = livepeer.generate.text_to_speech(request={})
assert res.audio_response is not None
# Handle response
print(res.audio_response)
operations.GenTextToSpeechResponse
Error Type |
Status Code |
Content Type |
errors.HTTPError |
400, 401, 500 |
application/json |
errors.HTTPValidationError |
422 |
application/json |
errors.SDKError |
4XX, 5XX |
*/* |