ducpy.search.image_ocr ====================== .. py:module:: ducpy.search.image_ocr .. autoapi-nested-parse:: Server-side image OCR helpers for DUC search. Uses ``rapidocr-onnxruntime`` with custom PP-OCRv6_tiny ONNX models when the ``ocr`` extra is installed, otherwise OCR is gracefully skipped. Attributes ---------- .. autoapisummary:: ducpy.search.image_ocr.logger ducpy.search.image_ocr._RAPID_OCR_ENGINE ducpy.search.image_ocr._server_side_ocr_available ducpy.search.image_ocr._extract_image_text_with_ocr Functions --------- .. autoapisummary:: ducpy.search.image_ocr.server_side_ocr_available ducpy.search.image_ocr._get_local_cache_dir ducpy.search.image_ocr._get_rapid_engine ducpy.search.image_ocr.extract_image_text_with_ocr Module Contents --------------- .. py:data:: logger .. py:data:: _RAPID_OCR_ENGINE :type: Any | None :value: None .. py:function:: server_side_ocr_available() -> bool Return whether the ``ocr`` extra (RapidOCR) is installed and usable. .. py:function:: _get_local_cache_dir(repo_id: str) -> str | None .. py:function:: _get_rapid_engine() -> Any .. py:function:: extract_image_text_with_ocr(image_bytes: bytes, *, ocr_language: str) -> tuple[str, bool] OCR an image using the ``ocr`` extra, or skip when unavailable. .. py:data:: _server_side_ocr_available .. py:data:: _extract_image_text_with_ocr