You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
wasm: one demo page with the whole pipeline (#157)
The browser demo had grown into three pages: index.html (declarative only,
no PDF/image, no output-format parity) plus ocr.html and scan.html, which
were really OCR test harnesses. Fold everything into index.html and delete
the other two.
The single page now covers what the module can actually do: any supported
document, PDF via its text layer, and — falling back automatically when a
PDF has no text layer — scanned pages and images through the ONNX pipeline.
Output picks between Markdown, docling JSON and DocLang XML; a Markdown
preview renders the result. The OCR half (ORT, pdf.js, models) loads lazily,
so a visitor converting a DOCX downloads none of it.
Supporting changes:
- convert() takes `images` ("placeholder" | "embedded"), mirroring
docling-serve's option, so pictures can ride along as data URIs — there is
no `referenced` mode because a page cannot write files.
- ScannedConverter::finish and convert_scanned_image accept "doclang" too,
so both paths offer the same three output grammars; the format is threaded
through worker.js and pipeline.js.
- A dead module worker (blocked CDN, offline, strict extension) used to
leave every pending RPC unsettled, so the page sat on "loading …"
forever. onerror/onmessageerror now reject the waiters with a message that
names the cause. Verified: the page reports the failure in ~30 s instead of
hanging.
- Drop the temporary layout-region diagnostic probe and its JS plumbing, and
the per-page console timing logs.
- Inline favicon so a static host never 404s on /favicon.ico.
Verified in headless Chromium against the real wasm module: DOCX → md/json/
doclang, images=placeholder vs embedded (data URI present), a corpus
text-layer PDF, the Markdown preview, and cross-origin isolation via coi.js
(crossOriginIsolated = true, so ORT gets threads).
Refs #157
Signed-off-by: artiz <artem.kustikov@gmail.com>
Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01EY5KAiquN4YpVf2PXEQkVT
0 commit comments