# SPDX-License-Identifier: Apache-2.0 """Paths of a development checkout (tests and dev scripts only; the server takes its paths from its configuration). Nothing is assumed about the machine: set the environment to point at your files, otherwise the tests that need them skip and the dev scripts refuse to start. DSOCR_WORKSPACE a checkout holding assets/dsocr (golden outputs, test images, run records) DSOCR_ASSETS that assets directory directly (overrides DSOCR_WORKSPACE) DSOCR_MODELS_ROOT a directory holding / weight checkouts (deepseek-ai/DeepSeek-OCR, ...) DSOCR_W_OCR1 / DSOCR_W_OCR2 / DSOCR_W_UOCR2 / DSOCR_W_SCHIFT one weight checkout each (override DSOCR_MODELS_ROOT) """ import os HERE = os.path.dirname(os.path.abspath(__file__)) WS = os.environ.get("DSOCR_WORKSPACE", "") ASSETS = os.environ.get("DSOCR_ASSETS") or (os.path.join(WS, "assets", "dsocr") if WS else "") _ROOT = os.environ.get("DSOCR_MODELS_ROOT", "") def _model(env: str, rel: str) -> str: return os.environ.get(env) or (os.path.join(_ROOT, rel) if _ROOT else "") MODELS = { "deepseek-ocr": _model("DSOCR_W_OCR1", "deepseek-ai/DeepSeek-OCR"), "deepseek-ocr-2": _model("DSOCR_W_OCR2", "deepseek-ai/DeepSeek-OCR-2"), "unlimited-ocr-2": _model("DSOCR_W_UOCR2", "baidu/Unlimited-OCR-2"), "schift-ocr-1-beta": _model("DSOCR_W_SCHIFT", "schift-io/schift-ocr-1-beta"), } GOLDEN = {k: (os.path.join(ASSETS, "golden", k) if ASSETS else "") for k in MODELS} RUNS = os.path.join(ASSETS, "runs") if ASSETS else ""