-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathconfig.py
More file actions
29 lines (25 loc) · 1.02 KB
/
config.py
File metadata and controls
29 lines (25 loc) · 1.02 KB
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
"""
Model location config. Load from .env in project root.
"""
import os
from pathlib import Path
# Load .env from project root (parent of app/)
_root = Path(__file__).resolve().parent
_env_file = _root / ".env"
if _env_file.exists():
with open(_env_file) as f:
for line in f:
line = line.strip()
if line and not line.startswith("#") and "=" in line:
k, _, v = line.partition("=")
k, v = k.strip(), v.strip().strip('"').strip("'")
if k and k not in os.environ:
os.environ[k] = v
# Model root: directory containing base.pt, large-v3.pt, etc.
# Default: models/ at project root
WHISPER_MODEL_ROOT = os.environ.get("WHISPER_MODEL_ROOT") or str(_root / "models")
# Per-model override: full path to .pt file (overrides MODEL_ROOT for that model)
WHISPER_MODEL_BASE = os.environ.get("WHISPER_MODEL_BASE")
WHISPER_MODEL_LARGE_V3 = os.environ.get("WHISPER_MODEL_LARGE_V3")
# Server port (default: 9876)
PORT = int(os.environ.get("PORT", "9876"))