Python Workflow

Prerequisites

  • Resemble PRO plan or above
  • API key (RESEMBLE_API_KEY environment variable)

1. Project setup

$python3 -m venv venv
>source venv/bin/activate
>pip install resemble
>pip freeze > requirements.txt

2. Implement main.py

1import os
2from resemble import Resemble
3
4
5def initialize_resemble_client():
6 api_key = os.environ.get("RESEMBLE_API_KEY")
7 if not api_key:
8 raise EnvironmentError("RESEMBLE_API_KEY is not set")
9 Resemble.api_key(api_key)
10
11
12def create_voice():
13 voice_name = "My Voice Clone"
14 dataset = "https://example.com/dataset.zip" # Replace with your dataset URL
15
16 print(f"Submitting request to create voice: {voice_name}")
17 response = Resemble.v2.voices.create(voice_name, dataset_url=dataset)
18
19 if response["success"]:
20 voice = response["item"]
21 print(
22 f"Created {voice_name} (UUID {voice['uuid']}). Status: {voice['status']}"
23 )
24 else:
25 print("Voice creation failed", response)
26
27
28def run_main():
29 initialize_resemble_client()
30 create_voice()
31
32
33if __name__ == "__main__":
34 run_main()

Verify the dataset URL is accessible and matches a supported format.

3. Run the script

$RESEMBLE_API_KEY=... python3 main.py

The response includes the new voice UUID and current build status (e.g., initializing). Track its progress via the API or the Voices dashboard.