""" Configuration constants and logging setup. """ import logging import os import sys import torch # ── Logging ───────────────────────────────────────────────────────────────── logging.basicConfig( level=logging.INFO, format="%(asctime)s - %(name)s - %(levelname)s - %(message)s", handlers=[logging.StreamHandler(sys.stdout)], ) logger = logging.getLogger("rvc") # ── Device detection ──────────────────────────────────────────────────────── if torch.cuda.is_available(): DEVICE = "cuda" DEVICE_LABEL = "GPU (CUDA)" elif torch.backends.mps.is_available(): DEVICE = "mps" DEVICE_LABEL = "GPU (Apple Metal)" else: DEVICE = "cpu" DEVICE_LABEL = "CPU" # ── Limits ────────────────────────────────────────────────────────────────── MAX_INPUT_DURATION = 600 # seconds (10 minutes) # ── Built-in models ───────────────────────────────────────────────────────── BUILTIN_MODELS = { "Vestia Zeta v1": "vestia_zeta_v1", "Vestia Zeta v2": "vestia_zeta_v2", "Ayunda Risu": "ayunda_risu", "Gawr Gura": "gawr_gura", } # ── Demucs configuration ──────────────────────────────────────────────────── DEMUCS_MODEL = "htdemucs" DEMUCS_DEVICE = "cuda" if torch.cuda.is_available() else "cpu" DEMUCS_SEPARATION_DIR = "separated" # ── Output formats ────────────────────────────────────────────────────────── OUTPUT_FORMATS = ["WAV", "MP3", "FLAC", "OPUS"] DEFAULT_OUTPUT_FORMAT = "MP3" # ── Paths ─────────────────────────────────────────────────────────────────── MODELS_DIR = "models" OUTPUTS_DIR = "outputs" # ── Gradio CSS ────────────────────────────────────────────────────────────── CSS = """ #header { text-align: center; margin-bottom: 1rem; } #status { text-align: center; font-weight: bold; } footer { visibility: hidden; } """