fix(ml): ocr failing with rootless docker (#23402)

don't download font
This commit is contained in:
Mert
2025-10-31 02:41:49 -04:00
committed by GitHub
parent 61a2c3ace3
commit 4abaad548a

View File

@@ -10,6 +10,7 @@ from rapidocr.inference_engine.base import FileInfo, InferSession
from rapidocr.utils import DownloadFile, DownloadFileInput from rapidocr.utils import DownloadFile, DownloadFileInput
from rapidocr.utils.typings import EngineType, LangRec, OCRVersion, TaskType from rapidocr.utils.typings import EngineType, LangRec, OCRVersion, TaskType
from rapidocr.utils.typings import ModelType as RapidModelType from rapidocr.utils.typings import ModelType as RapidModelType
from rapidocr.utils.vis_res import VisRes
from immich_ml.config import log, settings from immich_ml.config import log, settings
from immich_ml.models.base import InferenceModel from immich_ml.models.base import InferenceModel
@@ -31,6 +32,7 @@ class TextRecognizer(InferenceModel):
"text": [], "text": [],
"textScore": np.empty(0, dtype=np.float32), "textScore": np.empty(0, dtype=np.float32),
} }
VisRes.__init__ = lambda self, **kwargs: None # pyright: ignore[reportAttributeAccessIssue]
super().__init__(model_name, **model_kwargs, model_format=ModelFormat.ONNX) super().__init__(model_name, **model_kwargs, model_format=ModelFormat.ONNX)
def _download(self) -> None: def _download(self) -> None: