Originally created by: humdrum00001010
Local DeepSeek OCR currently requires CUDA. Add DeepSeekOCRLocalConfig(runtime="mlx") for Apple Silicon by replacing the existing extractor's selected model and loader with the compatible external MLX model. The CLI, OCR adapter, interruption handling, layout parsing, reconstruction and rendering stay on the existing pipeline. Runtime selection and the existing test extension total 18 changed lines; dependencies and setup are documented separately.
Tested on Heidegger's book:
A separate commit omits unlabelled opaque solid-white images from EPUB output, preserving labelled, transparent and near-white images. The upstream README is retained with ten added usage lines. Validation: 782 tests and 188 subtests passed, Pyright and Pylint passed, and fresh OCR of pages 81–82 produced valid EPUB output at 623/573 output tokens. After the cache-path correction, 31 targeted tests and seven native control checks passed, and page 82 again completed at 573 tokens. The full 182-page conversion was not rerun; an earlier page-123 OCR text omission remains a known model limitation.
Closes [#246]
Originally posted by: coderabbitai[bot]
📝 Walkthrough
`pdf_craft/ocr_config.py`, `pdf_craft_tool/runtime.py`, `pdf_craft/pdf/page_extractor.py`, `tests/test_ocr_config.py`|The OCR configuration accepts a `cuda` or `mlx` runtime. The environment setting selects the runtime, and the page extractor binds the MLX loader and model preprocessing when the runtime is `mlx`. The OCR test mocks the loader and checks the backend methods.| |**Apple Silicon CLI setup**
`pdf_craft_tool/requirements-mlx.txt`, `docs/en/MLX_CLI.md`, `README.md`|The requirements file adds MLX runtime dependencies. The guide and README describe the Apple Silicon CLI setup and invocation.| **Solid-white EPUB image filtering** |Layer / File(s)|Summary| |:---|:---| |**Detect and omit unannotated white images**
`pdf_craft/common/asset.py`, `pdf_craft/renderer/epub/render.py`, `tests/test_anchored_content_rendering.py`|The renderer omits an image when it is solid white and has no title, content, or caption. Parameterized tests check image inclusion and text continuity across image color, mode, and title cases.| **Priority:** ➖ Normal **Estimated code review effort:** 3 (Moderate) | ~25 minutes **Change:** Feature · **Severity of issue fixed:** Medium ### Sequence Diagram(s) :::mermaid sequenceDiagram participant Runtime as PDF_CRAFT_DEEPSEEK_OCR_LOCAL_RUNTIME participant Config as DeepSeekOCRLocalConfig participant Extractor as PageExtractorNode participant Loader as deepseek_ocr_mlx Runtime->>Config: Set runtime to mlx Config->>Extractor: Provide OCR runtime setting Extractor->>Loader: Bind loader and model preprocessing **Suggested reviewers:** `moskize91`
Merge Risk: 🔵 Low · up to
68199Security architecture risk: 🔵 Low · up to
68199Security review details
Pre-merge checks: <picture>
</picture> 3 · <picture>
</picture> 2
<picture>
</picture> Passed checks: 3 passed
Full details: Out of Scope Changes check
Full details: Docstring Coverage
✨ Finishing Touches
🧪 Generate unit tests (beta)
Comment
@coderabbitai helpto get the list of available commands.