Created
February 21, 2025 02:34
-
-
Save zironycho/3707022f7d8603ea38310fa755f82b98 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import requests | |
API_TOKEN = {{your token here}} | |
HEADERS = {'Authorization': f'Bearer {API_TOKEN}'} | |
# get my actor | |
r = requests.get('https://typecast.ai/api/actor', headers=HEADERS) | |
my_actors = r.json()['result'] | |
my_first_actor = my_actors[0] | |
my_first_actor_id = my_first_actor['actor_id'] | |
# request speech synthesis | |
r = requests.post('https://typecast.ai/api/text-to-speech', headers=HEADERS, json={ | |
'text': 'hello typecast', | |
'lang': 'auto', | |
'actor_id': my_first_actor_id, | |
'xapi_hd': True, | |
'model_version': 'latest' | |
}) | |
with open('test.wav', 'wb') as f: | |
f.write(r.content) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment