#!/usr/bin/env python3 """ Generate voice demo MP3 files for the 3 voice options. Run this script once to create static demo files. """ import requests import os API_URL = "https://api.microfunnel.online/api/v1/voice/synthesize" OUTPUT_DIR = r"d:\MicroFunnel Studio\frontend\public\voice-demos" VOICES = [ { "id": "professional_male", "text": "Здравствуйте! Я ваш менеджер. Готов помочь найти решение для бизнеса." }, { "id": "friendly_male", "text": "Привет! Рад что написали. Давайте разберёмся что вам нужно!" }, { "id": "professional_female", "text": "Добрый день! Спасибо за интерес. Расскажу подробнее." } ] def main(): os.makedirs(OUTPUT_DIR, exist_ok=True) for voice in VOICES: print(f"Generating {voice['id']}...") try: response = requests.post( API_URL, json={ "text": voice["text"], "voice": voice["id"] }, timeout=60 ) if response.status_code == 200: output_path = os.path.join(OUTPUT_DIR, f"{voice['id']}.mp3") with open(output_path, "wb") as f: f.write(response.content) print(f" OK: Saved to {output_path}") else: print(f" ERROR: {response.status_code}") except Exception as e: print(f" EXCEPTION: {e}") if __name__ == "__main__": main()