import requests import json import time url = "http://127.0.0.1:8000/generate" payload = json.dumps({ "speaker_name": "speaker1", "input_text": "Step into the future of accessibility with our revolutionary text-to-speech platform. Breaking down barriers for the visually impaired, our technology enables effortless access to written content, fostering inclusivity in the digital sphere. With customizable speech parameters and adaptable voices, users can tailor their listening experience to suit their preferences. Embrace the harmony of technology and humanity as we continue to pioneer advancements in the realm of audio communication. Empowering individuals with the gift of seamless interaction, our text-to-speech solution is paving the way for a more connected and accessible world", "emotion": "Neutral", "speed": 0 }) headers = { 'Content-Type': 'application/json' } start_time = time.time() # Start the timer response = requests.request("POST", url, headers=headers, data=payload) print("myres",response) end_time = time.time() # Stop the timer if response.status_code == 200: audio_content = response.content print(audio_content) # Save the audio to a file with open("generated_audio.wav", "wb") as audio_file: audio_file.write(audio_content) print("Audio saved successfully.") print("Time taken:", end_time - start_time, "seconds") else: print("Error:", response.text)