@@ -48,22 +48,27 @@ <h1>docling.rs → wasm: scanned PDF / image, full lite profile</h1>
4848 reconstruction (TableFormer is stage 3). Nothing leaves this page.
4949 </ p >
5050 < details id ="setup ">
51- < summary > The layout model is served from this page's own origin — fetch it once (~68 MB int8) </ summary >
51+ < summary > The layout model is served from this page's own origin — fetch it once into < code > ./models/ </ code > </ summary >
5252 < p >
5353 Unlike the recognition model (fetched from Hugging Face, which sends CORS
5454 headers), the RT-DETR layout export lives on this repo's GitHub Release,
5555 and < strong > GitHub Release assets can't be fetched cross-origin from a
5656 browser</ strong > (no < code > Access-Control-Allow-Origin</ code > ). So this
57- page loads the layout model < em > same-origin</ em > — put it next to this
58- file and serve the directory:
57+ page loads the layout model < em > same-origin</ em > , from a
58+ < code > models/</ code > directory next to it. Run the installer < strong > from
59+ this < code > www/</ code > directory</ strong > — it writes < code > ./models/</ code >
60+ relative to the current directory:
5961 </ p >
60- < pre > curl -fsSL https://raw.githubusercontent.com/ docling-project/docling.rs/master/scripts/install/download_dependencies.sh | sh
61- cp models/layout_heron_int8.onnx crates /docling-wasm/www/ # ~68 MB int8 (or layout_heron.onnx, ~172 MB fp32) </ pre >
62+ < pre > cd crates/ docling-wasm/www/
63+ curl -fsSL https://raw.githubusercontent.com /docling-project/docling.rs/master/scripts/install/download_dependencies.sh | sh </ pre >
6264 < p >
63- These are the exact models the native pipeline uses. The page prefers the
64- int8 export and falls back to fp32; both decode identically here (same
65- < code > pixel_values</ code > → < code > logits</ code > , < code > pred_boxes</ code >
66- contract).
65+ That populates < code > ./models/</ code > (this page reads
66+ < code > ./models/layout_heron_int8.onnx</ code > , ~68 MB, falling back to
67+ < code > ./models/layout_heron.onnx</ code > , ~172 MB — int8 needs a
68+ release that hosts it, otherwise fp32 is fetched). These are the exact
69+ conformance-validated models the native pipeline uses; both decode
70+ identically here (same < code > pixel_values</ code > → < code > logits</ code > , < code > pred_boxes</ code >
71+ contract). The recognition model still streams from Hugging Face on demand.
6772 </ p >
6873 </ details >
6974 < div id ="drop "> drop a scanned PDF or image here, or click to pick</ div >
@@ -88,13 +93,14 @@ <h1>docling.rs → wasm: scanned PDF / image, full lite profile</h1>
8893 pdfjs . GlobalWorkerOptions . workerSrc =
8994 "https://cdn.jsdelivr.net/npm/pdfjs-dist/build/pdf.worker.min.mjs" ;
9095
91- // The layout model is loaded SAME-ORIGIN (see the setup note above): GitHub
92- // Release assets carry no CORS header, so a browser fetch of the release URL
93- // fails — the model has to sit next to this page instead. Prefer the
96+ // The layout model is loaded SAME-ORIGIN from ./models/ (see the setup note
97+ // above): GitHub Release assets carry no CORS header, so a browser fetch of
98+ // the release URL fails — download_dependencies.sh, run from this www/
99+ // directory, drops the models next to this page instead. Prefer the
94100 // conv-only static-INT8 export (~68 MB, a big first-load win over the
95101 // ~172 MB fp32) and fall back to fp32; both share the same interop
96102 // contract, so the wrapper below is unchanged.
97- const LAYOUT_PATHS = [ "./layout_heron_int8.onnx" , "./layout_heron.onnx" ] ;
103+ const LAYOUT_PATHS = [ "./models/ layout_heron_int8.onnx" , "./models /layout_heron.onnx" ] ;
98104 const SCALE = 2.0 ; // px per PDF point — the native pipeline's RENDER_SCALE
99105
100106 const meta = document . getElementById ( "meta" ) ;
@@ -214,7 +220,7 @@ <h1>docling.rs → wasm: scanned PDF / image, full lite profile</h1>
214220 const layoutSession = await loadLayout ( ) ;
215221 if ( ! layoutSession ) {
216222 document . getElementById ( "setup" ) . open = true ;
217- ready ( "layout model not found next to this page — see the note above" ) ;
223+ ready ( "layout model not found under ./models/ — see the note above" ) ;
218224 throw new Error ( "no layout model available" ) ;
219225 }
220226 await recFor ( lang . value ) ;
0 commit comments