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}")