mlboydaisuke commited on
Commit
7fe60bf
Β·
verified Β·
1 Parent(s): e8f2c1c

gen-cards: regenerate Use-it block

Browse files
Files changed (1) hide show
  1. README.md +41 -0
README.md CHANGED
@@ -28,6 +28,47 @@ Runs on the **stock `coreai.runtime`** with **no engine patch** β€” the decoder
28
  on `inputs_embeds`, so this is a pure-export port (not the static-input-buffer VLM path).
29
 
30
  <!-- gen-cards:use-it begin id=unlimited-ocr (managed by scripts/gen-cards β€” edit cards.json / QuickStart.swift, not this block) -->
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
31
  <!-- gen-cards:use-it end -->
32
 
33
  ## What's exciting (why you'd use it)
 
28
  on `inputs_embeds`, so this is a pure-export port (not the static-input-buffer VLM path).
29
 
30
  <!-- gen-cards:use-it begin id=unlimited-ocr (managed by scripts/gen-cards β€” edit cards.json / QuickStart.swift, not this block) -->
31
+ ## Use it
32
+
33
+ ▢️ **Run it (source)** β€” the [ReadDoc runner](https://github.com/john-rocky/coreai-kit/tree/main/Examples/ReadDoc)
34
+ (GUI + CLI, one app for every document-OCR model in the catalog):
35
+
36
+ ```bash
37
+ git clone https://github.com/john-rocky/coreai-kit
38
+ open coreai-kit/Examples/ReadDoc/ReadDoc.xcodeproj
39
+ # β†’ Run, then pick "Unlimited-OCR" in the model picker
40
+
41
+ # agents / headless (macOS):
42
+ cd coreai-kit/Examples/ReadDoc
43
+ swift run readdoc-cli --model unlimited-ocr --image sample.png
44
+ ```
45
+
46
+ πŸ’» **Build with it** β€” complete; the glue is kit API, copy-paste runs:
47
+
48
+ ```swift
49
+ import CoreAIKit
50
+
51
+ let reader = try await KitDocReader(catalog: "unlimited-ocr")
52
+ let markdown = try await reader.read(imageAt: imageURL)
53
+ // markdown: the document as structured text β€” tables as <table>/<tr>/<td>,
54
+ // <|det|> layout boxes, reading order β€” fully on-device
55
+ ```
56
+
57
+ The take-home is [`Examples/ReadDoc/Sources/QuickStart.swift`](https://github.com/john-rocky/coreai-kit/blob/main/Examples/ReadDoc/Sources/QuickStart.swift)
58
+ β€” this exact code as one typed function, no UI; the CLI is an argument shell over it, and
59
+ the GUI drives the same `KitDocReader(catalog:)` on the image you pick.
60
+ One `read(imageAt:)` call per page; chunk a PDF into page images first. The output keeps
61
+ the model's structural markup (tables as HTML, formulas as LaTeX, `<|det|>` boxes) β€”
62
+ strip or render it as your app prefers.
63
+
64
+ **Integration checklist**
65
+
66
+ - SPM: `https://github.com/john-rocky/coreai-kit` β†’ product **CoreAIKit**
67
+ - Info.plist: none needed
68
+ - Entitlements: none needed
69
+ - First run downloads the model β€” 4.5 GB (Mac) β€” then it loads from the
70
+ local cache (Application Support; progress via the `downloadProgress` callback)
71
+ - Measure in Release β€” Debug is ~3Γ— slower on per-token host work
72
  <!-- gen-cards:use-it end -->
73
 
74
  ## What's exciting (why you'd use it)