If you have an existing video you want to use as a reference, follow this step.
This is where your face, expressions and voice are taken from. If the file is
larger than 5MB, follow the
Upload Large Resources guide
and note the resource_id. If not, you can
upload it directly.
files = { "file": ( "text.txt", bytes( "Hey Pranav, how do you make videos at Verbalia today?", "utf-8", ), "text/plain", )}# If you want to load a txt file from disk, comment out the above lines# and uncomment the below line# files = {'file': ('text.txt', open('text.txt', 'rb'), 'text/plain')}data = { "resource_name": "pranav-text", # Descriptive name "resource_type": "text", # One of the 5 types}# Make the POST requestscript_response = requests.post( base_url + "/resources/upload", files=files, params=data, headers=headers)# Check the responseif script_response.status_code != 200: print(f"Failed to upload file. Status code: {script_response.status_code}") print("Response:", script_response.text) sys.exit(1)print("Upload successful", script_response.json())# Contains resource_id which should be noted
This is just a regular generation, but the way you use your own face, expressions
and voice is by providing your reference video’s resource_id for the face and
voice.
Step 4: Poll for the status and download the video
Python
Copy
while True: time.sleep(60) # Poll every 60 seconds response = requests.get( base_url + "/status/" + generation_response.json()["request_id"], headers=headers, ) print(response.json()) # Status and video urls once completed if response.json()["status"] not in ["pending", "processing"]: breakif response.json()["status"] == "completed": video_response = requests.get(response.json()["video_url"]) with open("verbalia_personalize.mp4", "wb") as f: f.write(video_response.content) print("Downloaded video to verbalia_personalize.mp4")
To personalize to multiple audiences, repeat steps 2-4 with different
scripts.