File size: 927 Bytes
ba4a241 |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 |
from __future__ import annotations
import os
from pathlib import Path
from functools import lru_cache
BASE_DIR = Path(__file__).resolve().parents[3]
STATIC_DIR = BASE_DIR / "static"
AUDIO_DIR = STATIC_DIR / "audio"
MODEL_CACHE_DIR = BASE_DIR / "tmp" / "models"
FRONTEND_DIR = BASE_DIR / "frontend"
TMP_DIR = BASE_DIR / "tmp"
# Ensure required directories exist
for directory in (STATIC_DIR, AUDIO_DIR, MODEL_CACHE_DIR, TMP_DIR, FRONTEND_DIR):
directory.mkdir(parents=True, exist_ok=True)
class Settings:
app_name: str = "VoxSum Studio API"
static_dir: Path = STATIC_DIR
audio_dir: Path = AUDIO_DIR
frontend_dir: Path = FRONTEND_DIR
tmp_dir: Path = TMP_DIR
model_cache_dir: Path = MODEL_CACHE_DIR
max_audio_files: int = int(os.environ.get("VOXSUM_MAX_AUDIO_FILES", "20"))
transcription_chunk_size: int = 100
@lru_cache(maxsize=1)
def get_settings() -> Settings:
return Settings()
|