mirror of
https://github.com/immich-app/immich
synced 2025-11-07 17:27:20 +00:00
fix(ocr): expose lang_type (LangRec.CH) and font_path on OcrOptions for RapidOCR
This commit is contained in:
parent
7211086cb2
commit
b5a2bf5ae5
1 changed files with 4 additions and 2 deletions
|
|
@ -2,7 +2,7 @@ from typing import Iterable
|
||||||
|
|
||||||
import numpy as np
|
import numpy as np
|
||||||
import numpy.typing as npt
|
import numpy.typing as npt
|
||||||
from rapidocr.utils.typings import EngineType
|
from rapidocr.utils.typings import EngineType, LangRec
|
||||||
from typing_extensions import TypedDict
|
from typing_extensions import TypedDict
|
||||||
|
|
||||||
|
|
||||||
|
|
@ -19,8 +19,10 @@ class TextRecognitionOutput(TypedDict):
|
||||||
textScore: npt.NDArray[np.float32]
|
textScore: npt.NDArray[np.float32]
|
||||||
|
|
||||||
|
|
||||||
# RapidOCR expects engine_type to be an attribute
|
# RapidOCR expects `engine_type`, `lang_type`, and `font_path` to be attributes
|
||||||
class OcrOptions(dict):
|
class OcrOptions(dict):
|
||||||
def __init__(self, **options):
|
def __init__(self, **options):
|
||||||
super().__init__(**options)
|
super().__init__(**options)
|
||||||
self.engine_type = EngineType.ONNXRUNTIME
|
self.engine_type = EngineType.ONNXRUNTIME
|
||||||
|
self.lang_type = LangRec.CH
|
||||||
|
self.font_path = None
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue