import requests API_URL = "http://localhost:8000/api/v1/synthesize" def synthesize_text(text: str, output_file: str): """ Изпраща текст към API-то и запазва резултата като WAV файл. """ print(f"Изпращане на заявка за: '{text}'...") response = requests.post(API_URL, json={ "text": text, "voice_style": "F5", "speed": 1.6 }) if response.status_code == 200: with open(output_file, "wb") as f: f.write(response.content) print(f"✅ Аудиото е запазено успешно в: {output_file}") else: print(f"❌ Грешка: {response.status_code} - {response.text}") if __name__ == "__main__": text_to_say = "Здравей! Това е тестов запис, създаден чрез новото Ani Voice API." output_filename = "test_api_output.wav" synthesize_text(text_to_say, output_filename)