INNER CODE UNIT · Python

init_set_tts

bigsk1/voice-chat-ai · app/app.py:280

def init_set_tts(set_tts):
    global TTS_PROVIDER, sparktts_model
    if set_tts == 'sparktts':
        if not ensure_sparktts_available():
            print("Spark-TTS is not available. Please ensure it's properly installed.")
            loop = asyncio.get_running_loop()
            loop.create_task(send_message_to_clients(json.dumps({
                "action": "error",
                "message": "Spark-TTS is not available."
            })))
            return
        
        print(f"Initializing Spark-TTS model from {SPARKTTS_MODEL_DIR}...")
        try:
            torch_device = torch.device(device)
            print(f"Using device: {torch_device} (CUDA available: {torch.cuda.is_available()})")
            sparktts_model = SparkTTS(model_dir=Path(SPARKTTS_MODEL_DIR), device=torch_device)
            print(f"Spark-TTS model loaded successfully on {torch_device}.")

View source record →

📰 Research Paper
Loading…
⏳ Fetching content…