File size: 9,154 Bytes
18115ce
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
<div class="app" data-role="app">
  <aside class="side">
    <div class="brand">
      <span class="logo logo-light">__LOGO_LIGHT__</span><span class="logo logo-dark">__LOGO_DARK__</span>
      <span class="brand-sub">OCR-3</span>
      <button type="button" class="icon-btn theme" data-act="theme" title="Switch light / dark">
        <svg class="sun" viewBox="0 0 24 24" width="16" height="16" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round"><circle cx="12" cy="12" r="4"/><path d="M12 2v2M12 20v2M4.9 4.9l1.4 1.4M17.7 17.7l1.4 1.4M2 12h2M20 12h2M4.9 19.1l1.4-1.4M17.7 6.3l1.4-1.4"/></svg>
        <svg class="moon" viewBox="0 0 24 24" width="16" height="16" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><path d="M21 12.8A9 9 0 1 1 11.2 3a7 7 0 0 0 9.8 9.8z"/></svg>
      </button>
    </div>
    <p class="about">Page to Markdown with tables, math and reading order. Add one word, <code>grounding</code>, and every block comes back with a label and a box.</p>

    <section class="block">
      <div class="block-head"><span class="label">Document</span><span class="hint" data-role="doc-hint">PDF or image</span></div>
      <div class="drop" data-role="drop">
        <input type="file" accept=".pdf,image/*" data-role="file" hidden>
        <div class="drop-empty" data-role="drop-empty">
          <svg viewBox="0 0 24 24" width="22" height="22" fill="none" stroke="currentColor" stroke-width="1.8" stroke-linecap="round" stroke-linejoin="round"><path d="M12 16V4M7 9l5-5 5 5"/><path d="M20 16v3a1 1 0 0 1-1 1H5a1 1 0 0 1-1-1v-3"/></svg>
          <div><b>Drop a PDF or an image</b><span>or <u>browse</u> your files</span></div>
        </div>
        <div class="doc-card" data-role="doc-card" hidden>
          <svg class="doc-icon" viewBox="0 0 24 24" width="20" height="20" fill="none" stroke="currentColor" stroke-width="1.8" stroke-linecap="round" stroke-linejoin="round"><path d="M14 3H7a2 2 0 0 0-2 2v14a2 2 0 0 0 2 2h10a2 2 0 0 0 2-2V8z"/><path d="M14 3v5h5M9 13h6M9 17h6"/></svg>
          <div class="doc-meta"><div class="doc-name" data-role="doc-name"></div><div class="doc-sub" data-role="doc-sub"></div></div>
          <button type="button" class="icon-btn" data-act="clear" title="Remove this document">×</button>
        </div>
        <div class="pager" data-role="pager" hidden>
          <button type="button" data-act="prev" title="Previous page (←)">‹</button>
          <span class="pager-mid">Page <input type="number" min="1" data-role="page-input" aria-label="Page number"> <span data-role="page-count"></span></span>
          <button type="button" data-act="next" title="Next page (→)">›</button>
        </div>
      </div>
    </section>

    <section class="block">
      <div class="block-head"><span class="label">Model</span></div>
      <div class="models" data-role="models" role="radiogroup"></div>
    </section>

    <section class="block">
      <div class="block-head"><span class="label">Mode</span></div>
      <div class="seg" data-role="mode">
        <button type="button" data-mode="grounding">Grounding</button>
        <button type="button" data-mode="plain">Plain</button>
      </div>
      <p class="help" data-role="mode-help"></p>
    </section>

    <details class="block settings" data-role="settings">
      <summary><span class="label">Settings</span><span class="summary-value" data-role="settings-summary"></span><svg class="chev" viewBox="0 0 24 24" width="14" height="14" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><path d="M6 9l6 6 6-6"/></svg></summary>
      <div class="setting">
        <div class="setting-head"><span>Temperature</span><output data-role="temp-out"></output></div>
        <input type="range" min="0" max="1" step="0.05" data-role="temp">
        <p class="help">0.2 is what the model card uses. 0 is greedy decoding.</p>
      </div>
      <div class="setting">
        <div class="setting-head"><span>Max output tokens</span><output data-role="tokens-out"></output></div>
        <input type="range" min="256" max="12288" step="256" data-role="tokens">
        <p class="help">A dense page in grounding mode can need several thousand.</p>
      </div>
      <div class="setting">
        <div class="setting-head"><span>Page longest edge</span></div>
        <div class="seg small" data-role="edge">
          <button type="button" data-edge="2048">2048 px</button>
          <button type="button" data-edge="1540">1540 px</button>
          <button type="button" data-edge="1024">1024 px</button>
        </div>
        <p class="help">The model does not resize its input, so this is the inference resolution. 2048 is the training resolution.</p>
      </div>
    </details>

    <div class="actions">
      <button type="button" class="run" data-act="run"><span>Run OCR</span><kbd>⌘ ⏎</kbd></button>
      <button type="button" class="stop" data-act="stop" hidden>Stop</button>
    </div>

    <section class="block">
      <div class="block-head"><span class="label">Examples</span><span class="hint">click one to run it</span></div>
      <div class="examples" data-role="examples"></div>
    </section>

    <footer class="links">
      <a href="__COLLECTION__" target="_blank" rel="noopener">Models</a>
      <a href="__PAPER__" target="_blank" rel="noopener">Paper</a>
    </footer>
  </aside>

  <main class="stage" data-role="stage">
    <div class="bar">
      <div class="status">
        <span class="badge" data-role="mode-badge"></span>
        <span class="spin" data-role="spin" hidden></span>
        <span class="msg" data-role="message"></span>
      </div>
      <div class="tools">
        <div class="seg small" data-role="views">
          <button type="button" data-view="blocks" title="One card per layout block (b)">Blocks</button>
          <button type="button" data-view="doc" title="The transcription as one document (d)">Document</button>
          <button type="button" data-view="raw" title="Raw model output (r)">Raw</button>
        </div>
        <div class="seg small" data-role="zoom">
          <button type="button" data-zoom="out" title="Zoom out (−)">−</button>
          <button type="button" data-zoom="fit" title="Fit the page (0)">Fit</button>
          <button type="button" data-zoom="in" title="Zoom in (+)">+</button>
        </div>
        <button type="button" class="tool" data-act="copy" title="Copy the Markdown">Copy</button>
        <button type="button" class="tool" data-act="download" title="Download the Markdown">Download .md</button>
      </div>
      <nav class="bar-links">
        <a href="__BLOG__" target="_blank" rel="noopener" title="LightOnOCR-3 blog post"><svg viewBox="0 0 24 24" width="15" height="15" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><path d="M4 19.5A2.5 2.5 0 0 1 6.5 17H20"/><path d="M6.5 2H20v20H6.5A2.5 2.5 0 0 1 4 19.5v-15A2.5 2.5 0 0 1 6.5 2z"/></svg>Blog post</a>
        <a href="__WEBSITE__" target="_blank" rel="noopener" title="LightOn website"><svg viewBox="0 0 24 24" width="15" height="15" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><circle cx="12" cy="12" r="10"/><path d="M2 12h20"/><path d="M12 2a15.3 15.3 0 0 1 4 10 15.3 15.3 0 0 1-4 10 15.3 15.3 0 0 1-4-10 15.3 15.3 0 0 1 4-10z"/></svg>lighton.ai</a>
      </nav>
    </div>
    <div class="legend" data-role="chips" hidden></div>
    <div class="progress" data-role="progress" hidden><i></i></div>
    <div class="panes" data-role="panes">
      <div class="pane left" data-role="left">
        <div class="page" data-role="page" hidden>
          <img alt="The page as sent to the model" data-role="img">
          <div class="boxes" data-role="boxes"></div>
        </div>
        <div class="empty" data-role="empty">
          <svg class="empty-art" viewBox="0 0 120 150" width="96" height="120" aria-hidden="true">
            <rect x="4" y="4" width="112" height="142" rx="8" class="art-page"/>
            <rect x="18" y="20" width="56" height="9" rx="2" class="art-title"/>
            <rect x="18" y="38" width="84" height="5" rx="2" class="art-text"/>
            <rect x="18" y="48" width="84" height="5" rx="2" class="art-text"/>
            <rect x="18" y="58" width="60" height="5" rx="2" class="art-text"/>
            <rect x="18" y="74" width="84" height="38" rx="3" class="art-image"/>
            <rect x="18" y="120" width="84" height="5" rx="2" class="art-text"/>
            <rect x="18" y="130" width="48" height="5" rx="2" class="art-text"/>
          </svg>
          <div class="empty-title">Drop a page anywhere</div>
          <div class="empty-text">PDF or image. Or click an example in the sidebar.</div>
        </div>
      </div>
      <div class="gutter" data-role="gutter" title="Drag to resize"></div>
      <div class="pane right" data-role="right"><div class="panel" data-role="panel"></div></div>
    </div>
    <div class="veil" data-role="veil" hidden><div>Drop to open</div></div>
  </main>
</div>