You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 

22 lines
599 B

import requests
# Define the server URL
server_url = "http://localhost:5002/api/tts"
# Define the payload
payload = {
"text": "It took me quite a long time to develop a voice, and now that I have it I'm not going to be silent.",
"speaker": "Ana Florence",
"language": "en",
"split_sentences": True
}
# Send the request to the TTS server
response = requests.post(server_url, json=payload)
# Save the response audio to a file
if response.status_code == 200:
with open("output.wav", "wb") as f:
f.write(response.content)
else:
print(f"Error: {response.status_code}")