feat(ml): multilingual ocr (#23527)

* handle other languages in ml server

* add variants to model selector

* no need to override path

* unused import
This commit is contained in:
Mert
2025-11-06 12:58:41 -05:00
committed by GitHub
parent a4ae86ce29
commit 6913697ad1
5 changed files with 22 additions and 6 deletions

View File

@@ -23,7 +23,7 @@ class TextDetector(InferenceModel):
identity = (ModelType.DETECTION, ModelTask.OCR)
def __init__(self, model_name: str, **model_kwargs: Any) -> None:
super().__init__(model_name, **model_kwargs, model_format=ModelFormat.ONNX)
super().__init__(model_name.split("__")[-1], **model_kwargs, model_format=ModelFormat.ONNX)
self.max_resolution = 736
self.mean = np.array([0.5, 0.5, 0.5], dtype=np.float32)
self.std_inv = np.float32(1.0) / (np.array([0.5, 0.5, 0.5], dtype=np.float32) * 255.0)