Use a custom avatar
Learn how to use any face and voice in your generations
If any of the available avatar presets don’t suit your needs, Verbalia’s API offers a powerful set of features to mix and match faces and voices, as well as use your own.
Prerequisites
- You have an API key. If not, you can get one by contacting us.
- You have python installed on your machine along with the
requests
library
Mix and match available faces and voices
In any generation request, you can specify a face
and voice
instead of an avatar
name. You can use any face with any voice. Here’s an example:
body = {
"avatar": {
"face": "face-adam",
"voice": "voice-alice" # Only relevant if script type is "text"
},
"script": {
"resource_id": "<resource_id>",
"type": "<generation_type>"
},
}
generation_response = requests.post(
base_url + "/generate-video",
json=body,
headers=headers
)
Use a custom face
To use a custom face, you first need to create an image resource of the face.
If you’re not sure how to do it, follow the steps here
and note the resource_id
.
body = {
"avatar": {
"face": "<resource_id>", # The resource_id of your custom face image
"voice": "voice-alice" # Only relevant if script type is "text"
},
"script": {
"resource_id": "<resource_id>",
"type": "<generation_type>"
# The resource_id and type of your script ("text", "audio", "video")
# This is unrelated to the face's resource_id
},
}
generation_response = requests.post(
base_url + "/generate-video",
json=body,
headers=headers
)
When you specify a resource_id
for face
, Verbalia will automatically
detect the face in the image and initialize it as an avatar. Just make sure
that the resource is of type image
or video
and it contains a well-framed
face in it.
Use a custom voice
To use a custom voice, you first need to create an audio resource of a sample
recording of the voice.
If you’re not sure how to do it,
follow the steps here
and note the resource_id
.
body = {
"avatar": {
"face": "face-adam", # A default face or a custom face resource_id
"voice": "<resource_id>" # The resource_id of your custom voice sample
},
"script": {
"resource_id": "<resource_id>",
"type": "text"
# This is unrelated to the voice's resource_id
},
}
generation_response = requests.post(
base_url + "/generate-video",
json=body,
headers=headers
)
When you specify a resource_id
for voice
, Verbalia will automatically
clone the voice and use it in the generation. Just make sure that the resource
is of type audio
or video
and it contains a clear voice recording of at
least 1 minute with minimal background noise.
Was this page helpful?