mlboydaisuke commited on
Commit
d9ca766
路
verified 路
1 Parent(s): b834734

Load litert-ocr 0.2.0 (litert-ocr 31ce388, demo/)

Browse files
Files changed (3) hide show
  1. app.js +1 -1
  2. coi-serviceworker.js +2 -2
  3. index.html +2 -2
app.js CHANGED
@@ -6,7 +6,7 @@
6
 
7
  import { renderMarkdown } from './md.js';
8
 
9
- const LIBRARY = 'https://cdn.jsdelivr.net/npm/litert-ocr@0.1.0/+esm';
10
  /** Pages read per PDF on this page; the library itself reads up to `maxPages` (default 100). */
11
  const MAX_PAGES = 20;
12
  /** convert() reads PDF pages at 150 dpi; block boxes are in pixels of that size. */
 
6
 
7
  import { renderMarkdown } from './md.js';
8
 
9
+ const LIBRARY = 'https://cdn.jsdelivr.net/npm/litert-ocr@0.2.0/+esm';
10
  /** Pages read per PDF on this page; the library itself reads up to `maxPages` (default 100). */
11
  const MAX_PAGES = 20;
12
  /** convert() reads PDF pages at 150 dpi; block boxes are in pixels of that size. */
coi-serviceworker.js CHANGED
@@ -52,9 +52,9 @@ if (typeof window === 'undefined') {
52
  });
53
 
54
  // [litert-ocr demo] the files kept for offline visits: this origin's GET requests, the pinned library module and
55
- // the pdf.js version it pins (litert-ocr 0.1.0: pdfjs-dist 6.4.299)
56
  const OFFLINE_CACHE = "litert-ocr-demo-page";
57
- const keep = (r) => r.method === "GET" && (new URL(r.url).origin === self.location.origin || r.url === "https://cdn.jsdelivr.net/npm/litert-ocr@0.1.0/+esm" || r.url.startsWith("https://cdn.jsdelivr.net/npm/pdfjs-dist@6.4.299/"));
58
 
59
  function withHeaders(response) {
60
  const newHeaders = new Headers(response.headers);
 
52
  });
53
 
54
  // [litert-ocr demo] the files kept for offline visits: this origin's GET requests, the pinned library module and
55
+ // the pdf.js version it pins (litert-ocr 0.2.0: pdfjs-dist 6.4.299)
56
  const OFFLINE_CACHE = "litert-ocr-demo-page";
57
+ const keep = (r) => r.method === "GET" && (new URL(r.url).origin === self.location.origin || r.url === "https://cdn.jsdelivr.net/npm/litert-ocr@0.2.0/+esm" || r.url.startsWith("https://cdn.jsdelivr.net/npm/pdfjs-dist@6.4.299/"));
58
 
59
  function withHeaders(response) {
60
  const newHeaders = new Headers(response.headers);
index.html CHANGED
@@ -95,9 +95,9 @@
95
  <section id="about" class="about" aria-label="About this page">
96
  <h2>What this page does</h2>
97
  <p>Photos and screenshots: every text line and its box, in reading order (<code>worker.recognize(file)</code>). PDFs, scans and the Markdown and JSON tabs: pages with a text layer are read from it, scanned pages by OCR, and the lines become headings, paragraphs, lists and tables (<code>convert(file)</code>). A PDF's page is shown with a frame around each heading, paragraph, list item and table that <code>convert()</code> found on it, colored by type; the arrows under the page turn the pages read.</p>
98
- <p>Your files are read in this tab. The page downloads only the litert-ocr library, its LiteRT.js runtime and pdf.js from jsDelivr, and the model files from Hugging Face, once: about 80 MB over the network on the first visit (Chrome 155 on a Mac, 2026-10-22; 87 MB uncompressed, the size the status line shows). The browser keeps them. A page that is already open goes on reading with no network (tested in Chrome on a Mac and on an Android phone in airplane mode). Opening the page again with no network worked in Chrome on a Mac, not in Chrome on Android.</p>
99
  <p>The time shown is from handing the file to the library to the result, with the model already loaded. PDFs are read up to 20 pages per file here.</p>
100
- <p><a href="https://github.com/john-rocky/litert-ocr">Source and documentation</a> 路 <a href="https://github.com/john-rocky/litert-ocr/tree/main/demo">This page's code</a> 路 <span id="version">litert-ocr 0.1.0</span></p>
101
  </section>
102
  </main>
103
  </body>
 
95
  <section id="about" class="about" aria-label="About this page">
96
  <h2>What this page does</h2>
97
  <p>Photos and screenshots: every text line and its box, in reading order (<code>worker.recognize(file)</code>). PDFs, scans and the Markdown and JSON tabs: pages with a text layer are read from it, scanned pages by OCR, and the lines become headings, paragraphs, lists and tables (<code>convert(file)</code>). A PDF's page is shown with a frame around each heading, paragraph, list item and table that <code>convert()</code> found on it, colored by type; the arrows under the page turn the pages read.</p>
98
+ <p>Your files are read in this tab. The page downloads only the litert-ocr library, its LiteRT.js runtime and pdf.js from jsDelivr, and the model files from Hugging Face, once: about 80 MB over the network on the first visit (litert-ocr 0.1.0 in Chrome 155 on a Mac, 2026-10-22; 87 MB uncompressed, the size the status line shows). The browser keeps them. A page that is already open goes on reading with no network (tested in Chrome on a Mac and on an Android phone in airplane mode). Opening the page again with no network worked in Chrome on a Mac, not in Chrome on Android.</p>
99
  <p>The time shown is from handing the file to the library to the result, with the model already loaded. PDFs are read up to 20 pages per file here.</p>
100
+ <p><a href="https://github.com/john-rocky/litert-ocr">Source and documentation</a> 路 <a href="https://github.com/john-rocky/litert-ocr/tree/main/demo">This page's code</a> 路 <span id="version">litert-ocr 0.2.0</span></p>
101
  </section>
102
  </main>
103
  </body>