Repository navigation
ocr: POST /ocr in docTR's contract (#2440 step 5) - #2574
Conversation
|
Thanks @laudney. An early read of step 5: the both-kinds refusal is in all three places with a test through each envelope, content options off their defaults are refused one by one, and the source table answers the provenance question from #2530. Nothing new to ask here. It uses step 4's query reader, so the repeated-parameter fix we asked for on #2573 covers it too. It follows #2573 in the order you set out.
|
|
@ashhart rebased onto main
#2575 follows when this lands. |
|
Thank you, @laudney. This head merges cleanly with main. Interpreted query options use the duplicate-rejecting reader, and the mixed The page-origin change preserves the existing reader path while supplying each response's filename. No further changes are requested for this API step, subject to the normal CI checks.
|
docTR's API client posts one or more files parts with options in the query and reads one OCROut a page, so POST /ocr now answers it: parts typed by their exact Content-Type in part order, each PDF page named by its file, blocks and lines from the shared estimates in relative coordinates or 8-float polygons, pydantic booleans for the options, a docTR option sent twice refused, and content options off their documented defaults refused. A body with both files and file parts is refused as ambiguous on every path, the format query included, in the chosen envelope.
The API guide adds docTR to the /ocr contract choice, with the refusal of a body holding both files and file parts, its failure column, word estimates and scores, whole-page boxes for a reader without boxes, and the docTR section with its part types and query options, a repeated option refused; the changelog stays with the maintainer.
|
Thank you @laudney. This is merged into main with your commits under your own name, so you're listed as a TensorFold contributor. It ships in the next release, credited to you in the changelog and the release notes. |
filesparts, options in the query)POST /ocr: one OCROut a page or image, relative geometryfilesandfileparts?format=included: neither contract drops the other's partsStep 5 of the stack #2440 set out. It follows #2573, now on main.
doctr_test.zig: the README call on/ocrand/ocr/, part order, a PDF part, every query option (accepted, refused, malformed), part types, and the mixed-parts refusal through each dialect's envelopeProvenance, following your ruling on #2530: docTR's fields come from its published docs and the reply its README shows, not its tests or source, and every message is ours. This changed three things from #2530:
orientationis{"value": 0, "confidence": null}as the README reply shows (was all null);paragraph_breakis accepted only at its documented default 0.035; andbin_thresh/box_thresh, which have no documented API default, are refused. The part-type refusal is now our own text.Sources: R = api/README.md, UM = using_models, IO = io, FA = FastAPI handling errors.
POST /ocr, multipartfilesparts; types image/jpeg, image/png, application/pdfdet_arch,reco_arch(accepted, not read)assume_straight_pages(default true: boxes; false: polygons)resolve_lines(default true),resolve_blocks(default false),paragraph_break(only its default 0.035)detect_orientation,detect_language(accepted);straighten_pages,detect_layout,detect_tables(only false)bin_thresh,box_thresh(refused)name,orientation{"value": 0, "confidence": null},language{"value": null, "confidence": null},dimensions,items[{"blocks": [...]}]dimensions[height, width]geometry,objectness_score,confidence,value,crop_orientationlayoutandtables(always[])assume_straight_pages=false)[x, y]points instead{"detail": "..."}Retry-After, 500; every messageWhat this changes
POST /ocrgains docTR's API contract: one or morefilesparts (images or PDFs, by the part's type), options in the query, one OCROut a page in part order. Words come from a line's estimated word boxes, and every score is 1.0. With docTR and LiteParse served, a body with both kinds of parts is refused on every path, and a docTR option sent twice is 400.a0f809ea0, with ocr: POST /v1/ocr on dots.mocr for images (#2440 step 1) #2570 to ocr: POST /ocr in LiteParse's contract (#2440 step 4) #2573; 2 commitsatc overlap --jsonon this head: the open pull requests that share files with it (lfm3: add native Metal vision support above the text decoder #1502, Nemotron 3.5 Transcribe: audio input, the 65,536-token window, an hour of audio, MTP drafts #1632) merge clean.Checks on this head
fde877533, on maina0f809ea0. Rebuilt like ocr: PDF documents and pages on /v1/ocr, one page at a time (#2440 step 2) #2571 to ocr: POST /ocr in LiteParse's contract (#2440 step 4) #2573: the step-5 change, with the review fix (a docTR option sent twice is refused), applied to main in 2 commits with the original subjects. Each file's change equals the reviewed change;CHANGELOG.mdis no longer touched.python3 tools/zig/lean_check.py: 165 on main and 165 on this head, the same list, 0 new.zig build test-ocr-host test-api-boundaries test-server-cpu test-dots-mocr-host test-glm-ocr-host check-native-hip-host -Dhip=true: 24/24 steps, 2178 of 2196 pass, 18 skip, 0 failzig fmt --check zig/src build.zig zig/buildandgit diff --check: cleana0f809ea0is clean.TF_DOTS_OCR_DIRruns and no PDFium on this run); this step changes only test replies on the PDF path. CUDA, Metal and Windows: no OCR reader is offered there; the readers are wired into the HIP offers only.Receipt
/ocrand/ocr/on a JPEG: 200,dimensions[260, 900], 1 block, 10 words,orientation{"value": 0, "confidence": null}; anapplication/pdfpart: 2 OCROut namedreport.pdf; two files: 2 OCROut in part order;assume_straight_pages=False: 8-float geometry; a cut page: 422{"detail": "page 0: ..."}.--vision(--vision-pdffor PDF parts).9c9bf542c, checks on maina0f809ea0; Zig 0.17.0; ROCm 10.1 (hipcc HIP 7.16); one Radeon AI PRO R9700 (gfx1201); Linux; dots.mocrdots-studio/dots.mocre539fbb52280393adc081b289ec597430a0f9031, GLM-OCRzai-org/GLM-OCR2e85a62840ccac27daa451df36c736c4636b8628; PDFium chromium/7725; libjpeg-turbo 3.1.4.1. The end-to-end client receipts ran on the whole stack's code (c517f4379, byte-equal to step 6's OCR files), which serves this step's requests through this step's code.Checklist