| import os | |
| import logging | |
| from app.config import get_settings | |
| logger = logging.getLogger("test") | |
| settings = get_settings() | |
| _BACKEND_ROOT = os.path.dirname(os.path.dirname(os.path.abspath(__file__))) | |
| print(f"DEBUG: _BACKEND_ROOT = {_BACKEND_ROOT}") | |
| def _resolve_model_path(path: str) -> str: | |
| if os.path.isabs(path): | |
| return path | |
| # Anchor to the backend root (parent of personal_analysis/) | |
| candidate = os.path.abspath(os.path.join(_BACKEND_ROOT, path)) | |
| if os.path.exists(candidate): | |
| return candidate | |
| # Robust fallback for 'DON'T TOUCH' mangled environments | |
| if "OKIDI-DONT TOUCH" in candidate: | |
| healed = candidate.replace("OKIDI-DONT TOUCH", "OKIDI-DON'T TOUCH") | |
| if os.path.exists(healed): | |
| return healed | |
| return candidate | |
| rim = _resolve_model_path(settings.swish_ball_rim_model) | |
| print(f"FINAL RESOLVED: {rim}") | |