pyocr-toolkit 0.6.0__tar.gz → 0.8.0__tar.gz

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (118) hide show
  1. {pyocr_toolkit-0.6.0 → pyocr_toolkit-0.8.0}/.env.example +4 -1
  2. {pyocr_toolkit-0.6.0 → pyocr_toolkit-0.8.0}/CHANGELOG.md +84 -0
  3. {pyocr_toolkit-0.6.0 → pyocr_toolkit-0.8.0}/PKG-INFO +46 -5
  4. {pyocr_toolkit-0.6.0 → pyocr_toolkit-0.8.0}/README.md +43 -4
  5. {pyocr_toolkit-0.6.0 → pyocr_toolkit-0.8.0}/pyproject.toml +3 -1
  6. {pyocr_toolkit-0.6.0 → pyocr_toolkit-0.8.0}/src/pyocr_toolkit/__init__.py +1 -1
  7. {pyocr_toolkit-0.6.0 → pyocr_toolkit-0.8.0}/src/pyocr_toolkit/api.py +243 -4
  8. {pyocr_toolkit-0.6.0 → pyocr_toolkit-0.8.0}/src/pyocr_toolkit/cli.py +40 -15
  9. pyocr_toolkit-0.8.0/src/pyocr_toolkit/compare.py +656 -0
  10. {pyocr_toolkit-0.6.0 → pyocr_toolkit-0.8.0}/src/pyocr_toolkit/config.py +5 -2
  11. {pyocr_toolkit-0.6.0 → pyocr_toolkit-0.8.0}/src/pyocr_toolkit/documents.py +162 -20
  12. {pyocr_toolkit-0.6.0 → pyocr_toolkit-0.8.0}/src/pyocr_toolkit/env.example +4 -1
  13. pyocr_toolkit-0.8.0/src/pyocr_toolkit/remote.py +433 -0
  14. {pyocr_toolkit-0.6.0 → pyocr_toolkit-0.8.0}/src/pyocr_toolkit/service.py +154 -2
  15. {pyocr_toolkit-0.6.0 → pyocr_toolkit-0.8.0}/src/pyocr_toolkit/static/common.js +242 -0
  16. pyocr_toolkit-0.8.0/src/pyocr_toolkit/static/compare.js +651 -0
  17. {pyocr_toolkit-0.6.0 → pyocr_toolkit-0.8.0}/src/pyocr_toolkit/static/document.js +77 -7
  18. pyocr_toolkit-0.8.0/src/pyocr_toolkit/static/leaderboard.js +137 -0
  19. {pyocr_toolkit-0.6.0 → pyocr_toolkit-0.8.0}/src/pyocr_toolkit/static/styles.css +323 -13
  20. {pyocr_toolkit-0.6.0 → pyocr_toolkit-0.8.0}/src/pyocr_toolkit/static/workspace.js +44 -12
  21. pyocr_toolkit-0.8.0/src/pyocr_toolkit/templates/_doctabs.html +17 -0
  22. {pyocr_toolkit-0.6.0 → pyocr_toolkit-0.8.0}/src/pyocr_toolkit/templates/_icons.html +1 -0
  23. pyocr_toolkit-0.8.0/src/pyocr_toolkit/templates/_section_tabs.html +14 -0
  24. {pyocr_toolkit-0.6.0 → pyocr_toolkit-0.8.0}/src/pyocr_toolkit/templates/base.html +34 -14
  25. pyocr_toolkit-0.8.0/src/pyocr_toolkit/templates/compare.html +162 -0
  26. pyocr_toolkit-0.8.0/src/pyocr_toolkit/templates/document.html +141 -0
  27. {pyocr_toolkit-0.6.0 → pyocr_toolkit-0.8.0}/src/pyocr_toolkit/templates/help.html +122 -13
  28. pyocr_toolkit-0.8.0/src/pyocr_toolkit/templates/home.html +72 -0
  29. pyocr_toolkit-0.8.0/src/pyocr_toolkit/templates/leaderboard.html +73 -0
  30. {pyocr_toolkit-0.6.0 → pyocr_toolkit-0.8.0}/src/pyocr_toolkit/templates/library.html +1 -1
  31. {pyocr_toolkit-0.6.0 → pyocr_toolkit-0.8.0}/src/pyocr_toolkit/templates/workspace.html +32 -14
  32. {pyocr_toolkit-0.6.0 → pyocr_toolkit-0.8.0}/src/pyocr_toolkit/templates/workspace_detail.html +2 -0
  33. {pyocr_toolkit-0.6.0 → pyocr_toolkit-0.8.0}/src/pyocr_toolkit/web.py +6 -7
  34. {pyocr_toolkit-0.6.0 → pyocr_toolkit-0.8.0}/src/pyocr_toolkit/workspaces.py +11 -3
  35. {pyocr_toolkit-0.6.0 → pyocr_toolkit-0.8.0}/tests/conftest.py +7 -0
  36. pyocr_toolkit-0.8.0/tests/test_api.py +281 -0
  37. pyocr_toolkit-0.8.0/tests/test_core.py +307 -0
  38. pyocr_toolkit-0.8.0/tests/test_remote.py +353 -0
  39. {pyocr_toolkit-0.6.0 → pyocr_toolkit-0.8.0}/tests/test_web.py +21 -2
  40. pyocr_toolkit-0.6.0/src/pyocr_toolkit/compare.py +0 -142
  41. pyocr_toolkit-0.6.0/src/pyocr_toolkit/static/compare.js +0 -160
  42. pyocr_toolkit-0.6.0/src/pyocr_toolkit/templates/_doctabs.html +0 -14
  43. pyocr_toolkit-0.6.0/src/pyocr_toolkit/templates/compare.html +0 -84
  44. pyocr_toolkit-0.6.0/src/pyocr_toolkit/templates/document.html +0 -138
  45. pyocr_toolkit-0.6.0/src/pyocr_toolkit/templates/home.html +0 -91
  46. pyocr_toolkit-0.6.0/tests/test_api.py +0 -124
  47. pyocr_toolkit-0.6.0/tests/test_core.py +0 -129
  48. {pyocr_toolkit-0.6.0 → pyocr_toolkit-0.8.0}/.gitignore +0 -0
  49. {pyocr_toolkit-0.6.0 → pyocr_toolkit-0.8.0}/CONTRIBUTING.md +0 -0
  50. {pyocr_toolkit-0.6.0 → pyocr_toolkit-0.8.0}/LICENSE +0 -0
  51. {pyocr_toolkit-0.6.0 → pyocr_toolkit-0.8.0}/hero-video/README.md +0 -0
  52. {pyocr_toolkit-0.6.0 → pyocr_toolkit-0.8.0}/hero-video/src/HeroDemo.tsx +0 -0
  53. {pyocr_toolkit-0.6.0 → pyocr_toolkit-0.8.0}/hero-video/src/Root.tsx +0 -0
  54. {pyocr_toolkit-0.6.0 → pyocr_toolkit-0.8.0}/hero-video/src/assets.d.ts +0 -0
  55. {pyocr_toolkit-0.6.0 → pyocr_toolkit-0.8.0}/hero-video/src/index.ts +0 -0
  56. {pyocr_toolkit-0.6.0 → pyocr_toolkit-0.8.0}/hero-video/src/motion.tsx +0 -0
  57. {pyocr_toolkit-0.6.0 → pyocr_toolkit-0.8.0}/hero-video/src/scenes/CatchScene.tsx +0 -0
  58. {pyocr_toolkit-0.6.0 → pyocr_toolkit-0.8.0}/hero-video/src/scenes/ColdOpenScene.tsx +0 -0
  59. {pyocr_toolkit-0.6.0 → pyocr_toolkit-0.8.0}/hero-video/src/scenes/MeasureScene.tsx +0 -0
  60. {pyocr_toolkit-0.6.0 → pyocr_toolkit-0.8.0}/hero-video/src/scenes/MontageScene.tsx +0 -0
  61. {pyocr_toolkit-0.6.0 → pyocr_toolkit-0.8.0}/hero-video/src/scenes/OutroScene.tsx +0 -0
  62. {pyocr_toolkit-0.6.0 → pyocr_toolkit-0.8.0}/hero-video/src/scenes/ThreeWaysScene.tsx +0 -0
  63. {pyocr_toolkit-0.6.0 → pyocr_toolkit-0.8.0}/hero-video/src/theme.ts +0 -0
  64. {pyocr_toolkit-0.6.0 → pyocr_toolkit-0.8.0}/hero-video/src/ui.tsx +0 -0
  65. {pyocr_toolkit-0.6.0 → pyocr_toolkit-0.8.0}/src/pyocr_toolkit/__main__.py +0 -0
  66. {pyocr_toolkit-0.6.0 → pyocr_toolkit-0.8.0}/src/pyocr_toolkit/brands.py +0 -0
  67. {pyocr_toolkit-0.6.0 → pyocr_toolkit-0.8.0}/src/pyocr_toolkit/credentials.py +0 -0
  68. {pyocr_toolkit-0.6.0 → pyocr_toolkit-0.8.0}/src/pyocr_toolkit/export.py +0 -0
  69. {pyocr_toolkit-0.6.0 → pyocr_toolkit-0.8.0}/src/pyocr_toolkit/extract.py +0 -0
  70. {pyocr_toolkit-0.6.0 → pyocr_toolkit-0.8.0}/src/pyocr_toolkit/jobs.py +0 -0
  71. {pyocr_toolkit-0.6.0 → pyocr_toolkit-0.8.0}/src/pyocr_toolkit/llm/__init__.py +0 -0
  72. {pyocr_toolkit-0.6.0 → pyocr_toolkit-0.8.0}/src/pyocr_toolkit/llm/anthropic_provider.py +0 -0
  73. {pyocr_toolkit-0.6.0 → pyocr_toolkit-0.8.0}/src/pyocr_toolkit/llm/base.py +0 -0
  74. {pyocr_toolkit-0.6.0 → pyocr_toolkit-0.8.0}/src/pyocr_toolkit/llm/catalog.py +0 -0
  75. {pyocr_toolkit-0.6.0 → pyocr_toolkit-0.8.0}/src/pyocr_toolkit/llm/gemini_provider.py +0 -0
  76. {pyocr_toolkit-0.6.0 → pyocr_toolkit-0.8.0}/src/pyocr_toolkit/llm/openai_provider.py +0 -0
  77. {pyocr_toolkit-0.6.0 → pyocr_toolkit-0.8.0}/src/pyocr_toolkit/llm/prompts.py +0 -0
  78. {pyocr_toolkit-0.6.0 → pyocr_toolkit-0.8.0}/src/pyocr_toolkit/ocr/__init__.py +0 -0
  79. {pyocr_toolkit-0.6.0 → pyocr_toolkit-0.8.0}/src/pyocr_toolkit/ocr/base.py +0 -0
  80. {pyocr_toolkit-0.6.0 → pyocr_toolkit-0.8.0}/src/pyocr_toolkit/ocr/cloud.py +0 -0
  81. {pyocr_toolkit-0.6.0 → pyocr_toolkit-0.8.0}/src/pyocr_toolkit/ocr/local.py +0 -0
  82. {pyocr_toolkit-0.6.0 → pyocr_toolkit-0.8.0}/src/pyocr_toolkit/ocr/tesseract.py +0 -0
  83. {pyocr_toolkit-0.6.0 → pyocr_toolkit-0.8.0}/src/pyocr_toolkit/pdftext.py +0 -0
  84. {pyocr_toolkit-0.6.0 → pyocr_toolkit-0.8.0}/src/pyocr_toolkit/preprocess.py +0 -0
  85. {pyocr_toolkit-0.6.0 → pyocr_toolkit-0.8.0}/src/pyocr_toolkit/search.py +0 -0
  86. {pyocr_toolkit-0.6.0 → pyocr_toolkit-0.8.0}/src/pyocr_toolkit/static/jobs.js +0 -0
  87. {pyocr_toolkit-0.6.0 → pyocr_toolkit-0.8.0}/src/pyocr_toolkit/static/library.js +0 -0
  88. {pyocr_toolkit-0.6.0 → pyocr_toolkit-0.8.0}/src/pyocr_toolkit/static/logos/README.md +0 -0
  89. {pyocr_toolkit-0.6.0 → pyocr_toolkit-0.8.0}/src/pyocr_toolkit/static/logos/claude.svg +0 -0
  90. {pyocr_toolkit-0.6.0 → pyocr_toolkit-0.8.0}/src/pyocr_toolkit/static/logos/googlecloud.svg +0 -0
  91. {pyocr_toolkit-0.6.0 → pyocr_toolkit-0.8.0}/src/pyocr_toolkit/static/logos/googlegemini.svg +0 -0
  92. {pyocr_toolkit-0.6.0 → pyocr_toolkit-0.8.0}/src/pyocr_toolkit/static/logos/mistralai.svg +0 -0
  93. {pyocr_toolkit-0.6.0 → pyocr_toolkit-0.8.0}/src/pyocr_toolkit/static/logos/paddlepaddle.svg +0 -0
  94. {pyocr_toolkit-0.6.0 → pyocr_toolkit-0.8.0}/src/pyocr_toolkit/static/models.js +0 -0
  95. {pyocr_toolkit-0.6.0 → pyocr_toolkit-0.8.0}/src/pyocr_toolkit/static/providers.js +0 -0
  96. {pyocr_toolkit-0.6.0 → pyocr_toolkit-0.8.0}/src/pyocr_toolkit/static/reader.js +0 -0
  97. {pyocr_toolkit-0.6.0 → pyocr_toolkit-0.8.0}/src/pyocr_toolkit/static/search.js +0 -0
  98. {pyocr_toolkit-0.6.0 → pyocr_toolkit-0.8.0}/src/pyocr_toolkit/static/workspaces.js +0 -0
  99. {pyocr_toolkit-0.6.0 → pyocr_toolkit-0.8.0}/src/pyocr_toolkit/templates/_brand.html +0 -0
  100. {pyocr_toolkit-0.6.0 → pyocr_toolkit-0.8.0}/src/pyocr_toolkit/templates/_doc_card.html +0 -0
  101. {pyocr_toolkit-0.6.0 → pyocr_toolkit-0.8.0}/src/pyocr_toolkit/templates/_llm_picker.html +0 -0
  102. {pyocr_toolkit-0.6.0 → pyocr_toolkit-0.8.0}/src/pyocr_toolkit/templates/error.html +0 -0
  103. {pyocr_toolkit-0.6.0 → pyocr_toolkit-0.8.0}/src/pyocr_toolkit/templates/jobs.html +0 -0
  104. {pyocr_toolkit-0.6.0 → pyocr_toolkit-0.8.0}/src/pyocr_toolkit/templates/models.html +0 -0
  105. {pyocr_toolkit-0.6.0 → pyocr_toolkit-0.8.0}/src/pyocr_toolkit/templates/providers.html +0 -0
  106. {pyocr_toolkit-0.6.0 → pyocr_toolkit-0.8.0}/src/pyocr_toolkit/templates/reader.html +0 -0
  107. {pyocr_toolkit-0.6.0 → pyocr_toolkit-0.8.0}/src/pyocr_toolkit/templates/search.html +0 -0
  108. {pyocr_toolkit-0.6.0 → pyocr_toolkit-0.8.0}/src/pyocr_toolkit/templates/workspaces.html +0 -0
  109. {pyocr_toolkit-0.6.0 → pyocr_toolkit-0.8.0}/tests/__init__.py +0 -0
  110. {pyocr_toolkit-0.6.0 → pyocr_toolkit-0.8.0}/tests/test_batch.py +0 -0
  111. {pyocr_toolkit-0.6.0 → pyocr_toolkit-0.8.0}/tests/test_extract.py +0 -0
  112. {pyocr_toolkit-0.6.0 → pyocr_toolkit-0.8.0}/tests/test_makefile.py +0 -0
  113. {pyocr_toolkit-0.6.0 → pyocr_toolkit-0.8.0}/tests/test_models.py +0 -0
  114. {pyocr_toolkit-0.6.0 → pyocr_toolkit-0.8.0}/tests/test_ocr_engines.py +0 -0
  115. {pyocr_toolkit-0.6.0 → pyocr_toolkit-0.8.0}/tests/test_pdftext.py +0 -0
  116. {pyocr_toolkit-0.6.0 → pyocr_toolkit-0.8.0}/tests/test_preprocess.py +0 -0
  117. {pyocr_toolkit-0.6.0 → pyocr_toolkit-0.8.0}/tests/test_providers.py +0 -0
  118. {pyocr_toolkit-0.6.0 → pyocr_toolkit-0.8.0}/tests/test_workspaces.py +0 -0
@@ -52,7 +52,8 @@ GOOGLE_VISION_API_KEY=
52
52
  AZURE_DOCUMENT_INTELLIGENCE_ENDPOINT=
53
53
  AZURE_DOCUMENT_INTELLIGENCE_KEY=
54
54
 
55
- # AWS Textract (credentials may also come from ~/.aws or AWS_PROFILE)
55
+ # AWS: Textract and importing from s3:// (pip install "pyocr-toolkit[s3]").
56
+ # Leave these empty on EC2 / SageMaker / with ~/.aws: boto3 then finds the profile or instance role.
56
57
  # AWS_REGION=us-east-1
57
58
  # AWS_ACCESS_KEY_ID=
58
59
  # AWS_SECRET_ACCESS_KEY=
@@ -65,6 +66,8 @@ MISTRAL_API_KEY=
65
66
  # --- Storage, rendering and OCR ---------------------------------------------------
66
67
  # DATA_DIR=data
67
68
  # MAX_UPLOAD_MB=200
69
+ # Most files one import from S3 / web links may add
70
+ # IMPORT_MAX_FILES=500
68
71
  # PREVIEW_DPI=110
69
72
  # LLM_DPI=200
70
73
  # LLM_MAX_EDGE_PX=2400
@@ -2,6 +2,90 @@
2
2
 
3
3
  ## Unreleased
4
4
 
5
+ ## 0.8.0 - 2026-11-28
6
+
7
+ - **Import from S3 and links, for running on EC2 or SageMaker.** `pyocr import s3://bucket/file.pdf`,
8
+ `s3://bucket/folder/` (everything under it, zips unpacked) and `https://` links (S3 presigned URLs work without
9
+ AWS credentials), mixed freely with local files. In the web app, use *Import from S3 or a link* on Home, on a
10
+ workspace page or in the Ctrl+K palette; it calls the new `POST /api/imports`. Files are copied into `DATA_DIR`
11
+ like uploads. S3 needs the new `[s3]` extra (boto3) and uses the standard AWS credential chain, so a laptop
12
+ profile, an EC2 instance role or a SageMaker execution role works with no settings. The `AWS_*` settings
13
+ override it. `pyocr doctor` shows which credentials were found and from where, never their values. New
14
+ setting: `IMPORT_MAX_FILES` (default 500). Links to cloud metadata addresses are refused.
15
+ - LLM prompts and cache keys are unchanged, so existing results stay valid.
16
+
17
+ ## 0.7.0 - 2026-11-28
18
+
19
+ - **Calmer interface, same features.** The top bar has three sections, *Documents* (Workspaces / All files / Leaderboard),
20
+ *Search* and *Settings* (Providers / Models), plus a *Jobs* pill that shows how many extractions are running.
21
+ **Ctrl+K / ⌘K** opens a command palette on every page: jump to any page or document by name, run the current
22
+ document's actions (extract, compare, every export) or search all documents' text. Inside a document, the
23
+ breadcrumb, the view tabs and a new **Extract** button share one row.
24
+ - *Overview*: sources are a simple list (coverage, Read, an export menu); only running or failed jobs are shown;
25
+ the original file, metadata and Delete move to the bottom. Extraction opens in a side panel (the Extract
26
+ button, `x`, or `#extract` in the URL) with engine, model and pages up front and image preprocessing, pages
27
+ per request and re-run under *More options*, whose summary line shows their current values.
28
+ - *Pages* (the page inspector): sources (Native / OCR / LLM) on the left of the text panel and the two views,
29
+ *Diff* and *Columns* (was *Side by side*), on the right; page and zoom controls float over the page image.
30
+ The LLM tab folds provider, model, prompt and image into one line ("Model: demo-vision · Verbatim Change"),
31
+ which opens by itself when the chosen provider isn't configured; Re-run and Delete move to a ⋯ menu, and the
32
+ stored-result picker shows only when the page has more than one result.
33
+ - Fixed: re-running an LLM transcription in the inspector no longer counts it twice in the page list.
34
+ - *Home* and *Compare* drop the explainer text and stat tiles; Compare's case/punctuation options move to an
35
+ Options menu.
36
+
37
+ - **Compare explains its numbers.** A single CER can't tell a dropped umlaut from a wrong invoice total or an invented
38
+ sentence, so the Compare page now also shows:
39
+ - word errors split into **misread / missed / added** (they add up to the word edit distance behind WER), for the
40
+ whole document and per page;
41
+ - **numbers read exactly**: every token with a digit (amounts, dates, IDs) checked on its own, with the wrong ones
42
+ listed (`2,530.54 → 2.530,54`);
43
+ - each page's errors **by kind** (numbers, misread words, accents / ß, case, punctuation, split or joined words,
44
+ missed, added, stray scan marks) and the most common **character confusions** (`0→O`, `m→rn`);
45
+ - **CER as differences are forgiven**: the page's CER with case, punctuation and accents ignored and added text
46
+ dropped, step by step, so you can see how much of it is real misreading.
47
+ The page inspector's compare tab shows the misread / missed / added split and the number check too, and
48
+ `pyocr compare` prints an *OCR numbers* column. API: `errors`, `numbers` and `ladder` on
49
+ `POST /api/documents/{id}/pages/{n}/compare`; `errors` and `numbers` per page and in `overall` on
50
+ `GET /api/documents/{id}/compare`. Existing fields are unchanged.
51
+ - **Compare all sources at once.** The Compare page has a new *All sources* mode: tick three or more sources and
52
+ they are voted word by word into a **consensus**, so no source has to be assumed right. Each source is scored
53
+ against the consensus (CER, WER, misread / missed / added, numbers), with a sources × pages grid, the consensus
54
+ text showing every disputed word with its vote count and what the other sources read (close calls, where no
55
+ reading has a majority, in amber; "only lines that disagree" hides the rest), a copy button, and a matrix of how
56
+ much each pair of sources agrees. Sources with no text on a page don't vote there, and pages with only two voters
57
+ are flagged, since two readings can't outvote each other. API: `GET /api/documents/{id}/consensus` and
58
+ `GET /api/documents/{id}/pages/{n}/consensus` (`?sources=` 2–8 ids).
59
+ - **Review & correct.** On the consensus page view, *Review & correct* puts the page image next to the text: click a
60
+ word to see it highlighted on the image and every source's reading of it, pick the right one or type your own, and
61
+ the next close call is selected. *Save corrected text* stores the page as a new **Corrected** source (ground
62
+ truth): it can be exported, read on *Full text*, and becomes the default reference in two-source mode. Stored in
63
+ `corrected/<page>.json` in the document's folder; existing folders are unaffected. API:
64
+ `GET/PUT/DELETE /api/documents/{id}/pages/{n}/corrected`; the page consensus adds a word `box` per column (from
65
+ native text or OCR), `page_size` and the page's `corrected` state.
66
+ - **WER in any order** (order-free WER): the texts compared as bags of words, so words read in a different order
67
+ (columns read across, table rows or side notes in another sequence) aren't counted as errors. The gap to WER is
68
+ the cost of reading order alone. Shown next to WER on the Compare page (whole document, per page, in the table),
69
+ in the inspector, on consensus source cards and as a Leaderboard column. When most of a page's word error is
70
+ reading order, the page's breakdown says so, and the number check reports how many numbers are present at another
71
+ position. API: `wer_order_free`, `word_distance_order_free`, `words_missing` and `words_extra` in every `metrics`
72
+ (`score()`); `wer_order_free` in document `overall`, consensus `overall` and leaderboard entries; `present` in
73
+ `numbers`.
74
+ - **Leaderboard** (new page, `/leaderboard`, also linked from each workspace): every OCR engine, LLM run and PDF
75
+ library ranked across the whole library or one workspace, with CER and WER, misread / missed / added, numbers read
76
+ exactly, pages scored, and for LLM runs cost per page at catalog list price and model time per page; sortable, with
77
+ a sources × documents grid. Each page is scored against corrected text where it has it (real accuracy), otherwise
78
+ the consensus of three or more independent sources (agreement: the page says so); *Score against* can force either.
79
+ *Only pages every source has read* compares like for like. Extraction runs and corrected text aren't ranked.
80
+ API: `GET /api/leaderboard?workspace=&reference=auto|corrected|consensus&shared=`.
81
+ - Faster Overview for large documents: per-page facts (size, text-layer characters, images) are computed once and
82
+ saved to `pages.json` in the document folder, so later visits to a 2,000-page PDF's Overview drop from ~2.5 s
83
+ to ~40 ms. Uploads build `pages.json` in the background right away, so the first visit is fast too, and page
84
+ renders keep working while it runs. The page grid draws thumbnails in batches of 200 as you scroll. Existing
85
+ folders (and documents added with `pyocr add`) get `pages.json` on first view; it is derived data and is rebuilt
86
+ if missing or damaged.
87
+ - No new settings, and LLM prompts and cache keys are unchanged, so existing results stay valid.
88
+
5
89
  ## 0.6.0 - 2026-11-27
6
90
 
7
91
  - **Structured data extraction**: a new prompt, *Structured data (fields → JSON)*, fills a JSON Schema from each page
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.5
2
2
  Name: pyocr-toolkit
3
- Version: 0.6.0
3
+ Version: 0.8.0
4
4
  Summary: Inspect and compare PDF/image text extraction - native text, OCR engines (Tesseract, EasyOCR, PaddleOCR, docTR, RapidOCR, Google Vision, Azure, Textract, Mistral) and LLMs (Claude, GPT, Gemini, Azure, local) - in your browser.
5
5
  Project-URL: Homepage, https://github.com/utkarsh5026/pyocr
6
6
  Project-URL: Issues, https://github.com/utkarsh5026/pyocr/issues
@@ -259,6 +259,8 @@ Requires-Dist: pypdfium2>=4; extra == 'pdf'
259
259
  Provides-Extra: rapidocr
260
260
  Requires-Dist: onnxruntime>=1.17; extra == 'rapidocr'
261
261
  Requires-Dist: rapidocr>=2; extra == 'rapidocr'
262
+ Provides-Extra: s3
263
+ Requires-Dist: boto3>=1.34; extra == 's3'
262
264
  Provides-Extra: textract
263
265
  Requires-Dist: boto3>=1.34; extra == 'textract'
264
266
  Description-Content-Type: text/markdown
@@ -402,14 +404,16 @@ Everything you upload and extract is stored in `./data` (change it with `DATA_DI
402
404
  | **Home** `/` | Drop files to upload; see setup status and recent documents. |
403
405
  | **Library** `/documents` | Document cards showing native / OCR / LLM coverage and how many pages still have no text. Filter by status, workspace or name; delete. |
404
406
  | **Workspaces** `/workspaces` | Named groups of documents. Uploading several files or a `.zip` offers to create one, with suggested names (from the file names, or `adjective-scientist` like `festive-albattani`). Open one to rename it, add files or remove documents. |
405
- | **Overview** `/documents/{id}` | Start background extraction (any OCR engine or LLM) for all pages or a range such as `1-5,9`, typed or picked on a clickable page map (Shift-click for a range; presets for scans only or pages without text yet); choose pages per LLM request; follow progress; see every *source* (engine + model + prompt) with token usage; export; page thumbnails. |
406
- | **Page inspector** `/documents/{id}/pages/{n}` | Page image next to native, OCR and LLM text; run OCR or an LLM on just this page; per-page diff; a *Side by side* tab with all three texts in synced columns; search hits drawn on the image; *Adjust* to preprocess the image the LLM receives (filters, fine-tuning, crop/rotate) and A/B it against the original. Keyboard: `←/→`, `/`, `1-5`, `t`, `o`, `e`. |
407
+ | **Overview** `/documents/{id}` | Every *source* (engine + model + prompt) with coverage and token usage; read or export it; running jobs; page thumbnails. The **Extract** button in the document header (or `x`) opens a side panel to start background extraction (any OCR engine or LLM) for all pages or a range such as `1-5,9`, typed or picked on a clickable page map; *More options* holds image preprocessing, pages per LLM request and re-running. |
408
+ | **Pages** (page inspector) `/documents/{id}/pages/{n}` | Page image next to native, OCR and LLM text; run OCR or an LLM on just this page; a *Diff* view; a *Columns* view with all three texts in synced columns; search hits drawn on the image; *Adjust* to preprocess the image the LLM receives (filters, fine-tuning, crop/rotate) and A/B it against the original. Keyboard: `←/→`, `/`, `1-5`, `t`, `o`, `e`. |
407
409
  | **Full text** `/documents/{id}/text` | Read the whole document from one source, optionally beside the page images; find, copy, download. |
408
- | **Compare** `/documents/{id}/compare` | Score source B against source A on every page: document-level CER/WER, a clickable CER-per-page chart, and an aligned side-by-side diff of the selected page (opens on the worst page). Works for OCR vs LLM, native vs LLM, or **model vs model**. |
410
+ | **Compare** `/documents/{id}/compare` | Score source B against source A on every page: document-level CER/WER (plus WER in any order, which ignores reading order), word errors split into misread / missed / added, how many numbers (amounts, dates, IDs) were read exactly, a clickable CER-per-page chart, and an aligned side-by-side diff of the selected page with a breakdown of its errors by kind (opens on the worst page). **All sources** votes three or more sources into a word-by-word consensus and scores each against it, so you don't need to know which one is right; close calls are marked for review. **Review & correct** shows the page image next to the text, highlights each disputed word on it, and saves your choices as a *Corrected* source: ground truth to score every engine against. Works for OCR vs LLM, native vs LLM, or **model vs model**. |
409
411
  | **Search** `/search` | Search all documents at once. |
410
412
  | **Jobs** `/jobs` | All background extractions, with progress, errors and tokens. |
411
413
  | **Providers** `/providers` | Which settings are set or missing, a form to set keys/endpoints in the browser, plus a **Test connection** button per provider. |
412
414
  | **Models** `/models` | Search a catalog of vision models rated for transcription (excellent / good / fair / not suitable, with price and reason); list the models your key can use and pick one. |
415
+ | **Command palette** `Ctrl+K` / `⌘K` | On every page: open any page or document by name, run the current document's actions (extract, compare, export), or search every document's text. The top bar itself has three sections: Documents (Workspaces, All files, Leaderboard), Search, Settings (Providers, Models). |
416
+ | **Leaderboard** `/leaderboard` | Every OCR engine, LLM run and PDF library ranked across the library or one workspace: CER/WER, misread / missed / added, numbers read exactly, pages scored, cost and time per page. Each page is scored against your corrected text where you reviewed it, otherwise the consensus of three or more sources; *Only pages every source has read* makes it like for like. |
413
417
  | **Help** `/help` | The full guide: concepts, metrics, workflows, troubleshooting. |
414
418
  | **API docs** `/docs` | Interactive OpenAPI docs for the JSON API. |
415
419
 
@@ -488,6 +492,7 @@ pyocr compare scan.pdf -p openai -m gpt-6.2-sol # per-page OCR
488
492
  pyocr extract scan.pdf -p anthropic --preprocess 'gray;auto;contrast=1.5' # adjust the image first (or a preset: clean, bw, ...)
489
493
  pyocr extract invoice.pdf -p anthropic --mode extract --schema invoice --format json # fields, not text (or a JSON Schema file)
490
494
  pyocr import a.pdf b.pdf scans.zip folder/ -w invoices # add many files as one workspace (zips unpacked)
495
+ pyocr import s3://my-bucket/scans/2024/ -w scans-2024 # every PDF/image/zip under an S3 folder (see below)
491
496
  pyocr providers # which providers are ready
492
497
  pyocr engines # which OCR engines are ready
493
498
  python -m pyocr_toolkit --help # same CLI without the script on PATH
@@ -516,6 +521,40 @@ reported with the reason. A single file still uploads straight to the library. W
516
521
  (`data/workspaces/<id>.json`), so removing a document from one, or deleting a workspace, keeps the document unless
517
522
  you ask otherwise.
518
523
 
524
+ ### Import from S3 or a link (EC2, SageMaker)
525
+
526
+ On an EC2 instance or in SageMaker, documents usually live in S3. Paste `s3://` paths or `https://` links into
527
+ **Import from S3 or a link** (on Home, on a workspace page, or Ctrl+K), or pass them to `pyocr import`:
528
+
529
+ ```bash
530
+ pip install "pyocr-toolkit[s3]" # boto3, needed for s3:// only
531
+ pyocr import s3://my-bucket/scans/invoice-117.pdf # one file
532
+ pyocr import s3://my-bucket/scans/2024/ -w scans-2024 # everything under a folder (subfolders too), zips unpacked
533
+ pyocr import "https://my-bucket.s3.amazonaws.com/a.pdf?X-Amz-Signature=..." # a presigned URL: no AWS credentials needed
534
+ pyocr import local.pdf s3://my-bucket/more/ # local and remote in one workspace
535
+ pyocr doctor # shows which AWS credentials S3 would use, and from where
536
+ ```
537
+
538
+ The file is fetched once and copied into `DATA_DIR`, just like an upload, so everything else works the same and the
539
+ document stays usable if the object is later deleted.
540
+
541
+ **Credentials.** No AWS settings are needed in most cases. boto3 checks a fixed list of places in order: environment
542
+ variables, `~/.aws` profiles and SSO, container credentials, and the EC2 instance metadata service. So the same command
543
+ uses your profile on a laptop, the instance role on EC2 and the execution role in SageMaker. `pyocr doctor` tells you
544
+ which one it found. The role needs `s3:GetObject`, plus `s3:ListBucket` to import a folder. The optional `AWS_*`
545
+ settings (shared with Textract) override the chain, and `AWS_ENDPOINT_URL_S3` points at an S3-compatible server such as MinIO.
546
+
547
+ **Limits and safety.** Each file can be up to `MAX_UPLOAD_MB`, and one import adds at most `IMPORT_MAX_FILES` files (500 by default).
548
+ Hidden files and unsupported types in a folder are ignored. Anything that fails (missing, access denied, expired link)
549
+ is listed with the reason and the rest still imports. Links to cloud metadata addresses (169.254.169.254, including
550
+ behind redirects) are refused, because they serve the machine's own credentials. Signatures in presigned URLs are not echoed back in messages.
551
+ The import endpoint has the same cross-site protection as saving credentials.
552
+
553
+ **Viewing the app from your laptop.** `pyocr serve` listens on `127.0.0.1` only (there's no login). On EC2, use an SSH
554
+ tunnel rather than opening the port: `ssh -L 8000:127.0.0.1:8000 ec2-user@<host>`, then browse `http://localhost:8000`.
555
+ SageMaker Studio's `/proxy/<port>/` path isn't supported by the web UI yet (its links assume it is served at `/`);
556
+ the CLI works there.
557
+
519
558
  ## How it works
520
559
 
521
560
  1. **Native text.** A PDF page is a list of drawing instructions ("glyph 37 at (72, 700)"). Born-digital files map
@@ -532,7 +571,9 @@ you ask otherwise.
532
571
  between two texts. **CER** = edits / reference characters; **WER** is the same count over words. For example,
533
572
  "the cat sat" → "the bat sat" has 1 edit, so CER = 1/11 = 9%. Whitespace is normalised first, because line
534
573
  breaks aren't reading errors. Disagreement between two engines is not proof of error: compare against a
535
- born-digital PDF's native text when you need ground truth.
574
+ born-digital PDF's native text when you need ground truth. **WER in any order** compares the texts as bags of
575
+ words, so an engine that reads a two-column page across the columns isn't punished for order alone; the gap
576
+ between it and WER is the cost of reading order.
536
577
 
537
578
  The Help page explains each of these in more depth.
538
579
 
@@ -137,14 +137,16 @@ Everything you upload and extract is stored in `./data` (change it with `DATA_DI
137
137
  | **Home** `/` | Drop files to upload; see setup status and recent documents. |
138
138
  | **Library** `/documents` | Document cards showing native / OCR / LLM coverage and how many pages still have no text. Filter by status, workspace or name; delete. |
139
139
  | **Workspaces** `/workspaces` | Named groups of documents. Uploading several files or a `.zip` offers to create one, with suggested names (from the file names, or `adjective-scientist` like `festive-albattani`). Open one to rename it, add files or remove documents. |
140
- | **Overview** `/documents/{id}` | Start background extraction (any OCR engine or LLM) for all pages or a range such as `1-5,9`, typed or picked on a clickable page map (Shift-click for a range; presets for scans only or pages without text yet); choose pages per LLM request; follow progress; see every *source* (engine + model + prompt) with token usage; export; page thumbnails. |
141
- | **Page inspector** `/documents/{id}/pages/{n}` | Page image next to native, OCR and LLM text; run OCR or an LLM on just this page; per-page diff; a *Side by side* tab with all three texts in synced columns; search hits drawn on the image; *Adjust* to preprocess the image the LLM receives (filters, fine-tuning, crop/rotate) and A/B it against the original. Keyboard: `←/→`, `/`, `1-5`, `t`, `o`, `e`. |
140
+ | **Overview** `/documents/{id}` | Every *source* (engine + model + prompt) with coverage and token usage; read or export it; running jobs; page thumbnails. The **Extract** button in the document header (or `x`) opens a side panel to start background extraction (any OCR engine or LLM) for all pages or a range such as `1-5,9`, typed or picked on a clickable page map; *More options* holds image preprocessing, pages per LLM request and re-running. |
141
+ | **Pages** (page inspector) `/documents/{id}/pages/{n}` | Page image next to native, OCR and LLM text; run OCR or an LLM on just this page; a *Diff* view; a *Columns* view with all three texts in synced columns; search hits drawn on the image; *Adjust* to preprocess the image the LLM receives (filters, fine-tuning, crop/rotate) and A/B it against the original. Keyboard: `←/→`, `/`, `1-5`, `t`, `o`, `e`. |
142
142
  | **Full text** `/documents/{id}/text` | Read the whole document from one source, optionally beside the page images; find, copy, download. |
143
- | **Compare** `/documents/{id}/compare` | Score source B against source A on every page: document-level CER/WER, a clickable CER-per-page chart, and an aligned side-by-side diff of the selected page (opens on the worst page). Works for OCR vs LLM, native vs LLM, or **model vs model**. |
143
+ | **Compare** `/documents/{id}/compare` | Score source B against source A on every page: document-level CER/WER (plus WER in any order, which ignores reading order), word errors split into misread / missed / added, how many numbers (amounts, dates, IDs) were read exactly, a clickable CER-per-page chart, and an aligned side-by-side diff of the selected page with a breakdown of its errors by kind (opens on the worst page). **All sources** votes three or more sources into a word-by-word consensus and scores each against it, so you don't need to know which one is right; close calls are marked for review. **Review & correct** shows the page image next to the text, highlights each disputed word on it, and saves your choices as a *Corrected* source: ground truth to score every engine against. Works for OCR vs LLM, native vs LLM, or **model vs model**. |
144
144
  | **Search** `/search` | Search all documents at once. |
145
145
  | **Jobs** `/jobs` | All background extractions, with progress, errors and tokens. |
146
146
  | **Providers** `/providers` | Which settings are set or missing, a form to set keys/endpoints in the browser, plus a **Test connection** button per provider. |
147
147
  | **Models** `/models` | Search a catalog of vision models rated for transcription (excellent / good / fair / not suitable, with price and reason); list the models your key can use and pick one. |
148
+ | **Command palette** `Ctrl+K` / `⌘K` | On every page: open any page or document by name, run the current document's actions (extract, compare, export), or search every document's text. The top bar itself has three sections: Documents (Workspaces, All files, Leaderboard), Search, Settings (Providers, Models). |
149
+ | **Leaderboard** `/leaderboard` | Every OCR engine, LLM run and PDF library ranked across the library or one workspace: CER/WER, misread / missed / added, numbers read exactly, pages scored, cost and time per page. Each page is scored against your corrected text where you reviewed it, otherwise the consensus of three or more sources; *Only pages every source has read* makes it like for like. |
148
150
  | **Help** `/help` | The full guide: concepts, metrics, workflows, troubleshooting. |
149
151
  | **API docs** `/docs` | Interactive OpenAPI docs for the JSON API. |
150
152
 
@@ -223,6 +225,7 @@ pyocr compare scan.pdf -p openai -m gpt-6.2-sol # per-page OCR
223
225
  pyocr extract scan.pdf -p anthropic --preprocess 'gray;auto;contrast=1.5' # adjust the image first (or a preset: clean, bw, ...)
224
226
  pyocr extract invoice.pdf -p anthropic --mode extract --schema invoice --format json # fields, not text (or a JSON Schema file)
225
227
  pyocr import a.pdf b.pdf scans.zip folder/ -w invoices # add many files as one workspace (zips unpacked)
228
+ pyocr import s3://my-bucket/scans/2024/ -w scans-2024 # every PDF/image/zip under an S3 folder (see below)
226
229
  pyocr providers # which providers are ready
227
230
  pyocr engines # which OCR engines are ready
228
231
  python -m pyocr_toolkit --help # same CLI without the script on PATH
@@ -251,6 +254,40 @@ reported with the reason. A single file still uploads straight to the library. W
251
254
  (`data/workspaces/<id>.json`), so removing a document from one, or deleting a workspace, keeps the document unless
252
255
  you ask otherwise.
253
256
 
257
+ ### Import from S3 or a link (EC2, SageMaker)
258
+
259
+ On an EC2 instance or in SageMaker, documents usually live in S3. Paste `s3://` paths or `https://` links into
260
+ **Import from S3 or a link** (on Home, on a workspace page, or Ctrl+K), or pass them to `pyocr import`:
261
+
262
+ ```bash
263
+ pip install "pyocr-toolkit[s3]" # boto3, needed for s3:// only
264
+ pyocr import s3://my-bucket/scans/invoice-117.pdf # one file
265
+ pyocr import s3://my-bucket/scans/2024/ -w scans-2024 # everything under a folder (subfolders too), zips unpacked
266
+ pyocr import "https://my-bucket.s3.amazonaws.com/a.pdf?X-Amz-Signature=..." # a presigned URL: no AWS credentials needed
267
+ pyocr import local.pdf s3://my-bucket/more/ # local and remote in one workspace
268
+ pyocr doctor # shows which AWS credentials S3 would use, and from where
269
+ ```
270
+
271
+ The file is fetched once and copied into `DATA_DIR`, just like an upload, so everything else works the same and the
272
+ document stays usable if the object is later deleted.
273
+
274
+ **Credentials.** No AWS settings are needed in most cases. boto3 checks a fixed list of places in order: environment
275
+ variables, `~/.aws` profiles and SSO, container credentials, and the EC2 instance metadata service. So the same command
276
+ uses your profile on a laptop, the instance role on EC2 and the execution role in SageMaker. `pyocr doctor` tells you
277
+ which one it found. The role needs `s3:GetObject`, plus `s3:ListBucket` to import a folder. The optional `AWS_*`
278
+ settings (shared with Textract) override the chain, and `AWS_ENDPOINT_URL_S3` points at an S3-compatible server such as MinIO.
279
+
280
+ **Limits and safety.** Each file can be up to `MAX_UPLOAD_MB`, and one import adds at most `IMPORT_MAX_FILES` files (500 by default).
281
+ Hidden files and unsupported types in a folder are ignored. Anything that fails (missing, access denied, expired link)
282
+ is listed with the reason and the rest still imports. Links to cloud metadata addresses (169.254.169.254, including
283
+ behind redirects) are refused, because they serve the machine's own credentials. Signatures in presigned URLs are not echoed back in messages.
284
+ The import endpoint has the same cross-site protection as saving credentials.
285
+
286
+ **Viewing the app from your laptop.** `pyocr serve` listens on `127.0.0.1` only (there's no login). On EC2, use an SSH
287
+ tunnel rather than opening the port: `ssh -L 8000:127.0.0.1:8000 ec2-user@<host>`, then browse `http://localhost:8000`.
288
+ SageMaker Studio's `/proxy/<port>/` path isn't supported by the web UI yet (its links assume it is served at `/`);
289
+ the CLI works there.
290
+
254
291
  ## How it works
255
292
 
256
293
  1. **Native text.** A PDF page is a list of drawing instructions ("glyph 37 at (72, 700)"). Born-digital files map
@@ -267,7 +304,9 @@ you ask otherwise.
267
304
  between two texts. **CER** = edits / reference characters; **WER** is the same count over words. For example,
268
305
  "the cat sat" → "the bat sat" has 1 edit, so CER = 1/11 = 9%. Whitespace is normalised first, because line
269
306
  breaks aren't reading errors. Disagreement between two engines is not proof of error: compare against a
270
- born-digital PDF's native text when you need ground truth.
307
+ born-digital PDF's native text when you need ground truth. **WER in any order** compares the texts as bags of
308
+ words, so an engine that reads a two-column page across the columns isn't punished for order alone; the gap
309
+ between it and WER is the cost of reading order.
271
310
 
272
311
  The Help page explains each of these in more depth.
273
312
 
@@ -1,6 +1,6 @@
1
1
  [project]
2
2
  name = "pyocr-toolkit"
3
- version = "0.6.0"
3
+ version = "0.8.0"
4
4
  description = "Inspect and compare PDF/image text extraction - native text, OCR engines (Tesseract, EasyOCR, PaddleOCR, docTR, RapidOCR, Google Vision, Azure, Textract, Mistral) and LLMs (Claude, GPT, Gemini, Azure, local) - in your browser."
5
5
  readme = "README.md"
6
6
  requires-python = ">=3.10"
@@ -50,6 +50,8 @@ easyocr = ["easyocr>=1.7"]
50
50
  paddleocr = ["paddleocr>=3", "paddlepaddle>=3"]
51
51
  doctr = ["python-doctr[torch]>=0.10"]
52
52
  textract = ["boto3>=1.34"]
53
+ # Import documents from s3:// (https:// links, S3 presigned URLs included, need nothing extra).
54
+ s3 = ["boto3>=1.34"]
53
55
 
54
56
  [project.urls]
55
57
  Homepage = "https://github.com/utkarsh5026/pyocr"
@@ -1,3 +1,3 @@
1
1
  """pyocr-toolkit - inspect PDF/image text extraction: native text vs Tesseract OCR vs LLM transcription."""
2
2
 
3
- __version__ = "0.6.0"
3
+ __version__ = "0.8.0"