INNER CODE UNIT · Python
ensure_sparktts_available
bigsk1/voice-chat-ai · app/app.py:143
def ensure_sparktts_available():
global SparkTTS, SPARKTTS_AVAILABLE, torch
if SparkTTS is not None:
return True
try:
import sys
import logging
import warnings
import torch as torch_module
project_root = os.path.dirname(os.path.dirname(os.path.abspath(__file__)))
if project_root not in sys.path:
sys.path.insert(0, project_root)
from cli.SparkTTS import SparkTTS as SparkTTS_cls
logging.getLogger("transformers").setLevel(logging.ERROR)
warnings.filterwarnings("ignore", category=FutureWarning, module="torch.nn.utils.weight_norm")