File size: 720 Bytes
f340984 | 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 | from __future__ import annotations
import os
from pathlib import Path
from .constants import MODEL_REVISION
def data_home() -> Path:
value = os.environ.get("XDG_DATA_HOME")
return Path(value).expanduser() if value else Path.home() / ".local" / "share"
def cache_home() -> Path:
value = os.environ.get("XDG_CACHE_HOME")
return Path(value).expanduser() if value else Path.home() / ".cache"
def default_model_dir() -> Path:
override = os.environ.get("UNLIMITED_OCR_MODEL_DIR")
if override:
return Path(override).expanduser()
return data_home() / "unlimited-ocr-rdna4" / "models" / MODEL_REVISION
def default_cache_dir() -> Path:
return cache_home() / "unlimited-ocr-rdna4"
|