Repository navigation
pipeline: support direct OCR for known table crops - #246
Open
agourakis82 wants to merge 2 commits into
Open
agourakis82 wants to merge 2 commits into
agourakis82 wants to merge 2 commits into
Conversation
Contributor
There was a problem hiding this comment.
Copilot review overview
🟢 Approval recommended
The change is narrowly scoped, and the test verifies the prompt reaches the request payload.
Review effort: Balanced
Findings: None
What changed in this PR
This PR adds a numeric-fidelity instruction to the packaged self-hosted table-recognition prompt and checks that it reaches outgoing requests.
Changes:
- Ask table recognition to preserve decimal and thousands separators.
- Test that the packaged prompt appears in a table OCR request.
| File | Description |
|---|---|
glmocr/tests/test_unit.py |
Tests prompt delivery in the request payload. |
glmocr/config.yaml |
Updates the default table prompt. |
💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.
Author
|
Updated this PR from a prompt-only guardrail into a direct known-crop OCR path. New behavior:
This now matches the use case from #241: submit an already-known table crop without re-running layout detection on it. |
This branch has not been deployed
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
pipeline.enable_layout=falsedirect_task_typeso callers can mark a crop astext,table, orformulawithout re-running layout detectionGlmOcr(...),glmocr.parse(...), and CLI--disable-layout --direct-task-type tableWhy
Issue #241 reports that an isolated table crop can lose decimal commas when it is processed as a fresh document. The issue asks for a way to submit a known region as a table without re-running layout detection on the crop.
This PR adds that explicit path: callers can send the crop directly to OCR as a full-page table region.
CLI:
Python:
Tests
/Users/demetriosagourakis/dev/GLM-OCR/.venv/bin/python -m pre_commit run --files glmocr/config.py glmocr/config.yaml glmocr/pipeline/_workers.py glmocr/pipeline/pipeline.py glmocr/api.py glmocr/cli.py glmocr/tests/test_unit.pyuv run --with pytest -m pytest glmocr/tests/test_unit.py::TestConfig glmocr/tests/test_unit.py::TestPipelineDirectOcr glmocr/tests/test_unit.py::TestGlmOcrParseStream glmocr/tests/test_unit.py::TestGlmOcrConstructor glmocr/tests/test_unit.py::TestPageLoader -quv run --with pytest -m pytest glmocr/tests/test_unit.py -q