BadCoach / api /state.py
github-actions[bot]
Deploy: 2026-03-29 19:13 UTC — 8c9027ded0e44a53f792451cac9d3f510a85a93c
368c4eb
Raw
History Blame Contribute Delete
763 Bytes
"""Process-wide singletons populated at startup (see api.lifespan)."""
import asyncio
from cachetools import TTLCache
from api import config
device = "cpu"
model = None
model_architecture = "cnn_lstm"
pose_estimator = None
badminton_detector = None
dataset_metadata = None
gemini_enabled = False
gemini_client = None
gemini_model_name = "gemini-3.1-flash-lite-preview"
# Legacy /analyze + shared cache
_semaphore = asyncio.Semaphore(config.MAX_CONCURRENT_JOBS)
_active_jobs = 0
_active_jobs_lock = asyncio.Lock()
_result_cache: TTLCache = TTLCache(maxsize=128, ttl=3600)
_frame_tip_cache: dict = {}
# Live session stub
_live_semaphore = asyncio.Semaphore(config.MAX_CONCURRENT_LIVE_SESSIONS)
_live_sessions: dict[str, None] = {}
_live_lock = asyncio.Lock()