gen-cards: regenerate Use-it block
Browse files
README.md
CHANGED
|
@@ -21,6 +21,46 @@ Diffusion 2.1 UNet + a half-size VAE decoder, run in **one forward pass** β no
|
|
| 21 |
no prompt, no noise β so it is fast and small enough to run fully on-device, including iPhone.
|
| 22 |
|
| 23 |
<!-- gen-cards:use-it begin id=adcsr-x4 (managed by scripts/gen-cards β edit cards.json / QuickStart.swift, not this block) -->
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 24 |
<!-- gen-cards:use-it end -->
|
| 25 |
|
| 26 |
## What it is
|
|
|
|
| 21 |
no prompt, no noise β so it is fast and small enough to run fully on-device, including iPhone.
|
| 22 |
|
| 23 |
<!-- gen-cards:use-it begin id=adcsr-x4 (managed by scripts/gen-cards β edit cards.json / QuickStart.swift, not this block) -->
|
| 24 |
+
## Use it
|
| 25 |
+
|
| 26 |
+
βΆοΈ **Run it (source)** β the [UpscaleDemo runner](https://github.com/john-rocky/coreai-kit/tree/main/Examples/UpscaleDemo)
|
| 27 |
+
(pick a photo, upscale it Γ4 on-device):
|
| 28 |
+
|
| 29 |
+
```bash
|
| 30 |
+
git clone https://github.com/john-rocky/coreai-kit
|
| 31 |
+
open coreai-kit/Examples/UpscaleDemo/UpscaleDemo.xcodeproj
|
| 32 |
+
# β Run, pick a photo β the app loads AdcSR Γ4 (the catalog's superResolution entry) automatically
|
| 33 |
+
|
| 34 |
+
# agents / headless (macOS):
|
| 35 |
+
cd coreai-kit/Examples/UpscaleDemo
|
| 36 |
+
swift run upscale-cli --model adcsr-x4 --image sample_small.png --output big.png
|
| 37 |
+
```
|
| 38 |
+
|
| 39 |
+
π» **Build with it** β complete; the glue is kit API, copy-paste runs:
|
| 40 |
+
|
| 41 |
+
```swift
|
| 42 |
+
import CoreAIKitVision
|
| 43 |
+
|
| 44 |
+
let resolver = try await SuperResolver(catalog: "adcsr-x4")
|
| 45 |
+
let image = try ImageFile.load(imageURL) // any image file β CGImage + EXIF orientation
|
| 46 |
+
let upscaled = try await resolver.upscale(image.cgImage)
|
| 47 |
+
// upscaled: CGImage β 4Γ the input's pixels
|
| 48 |
+
```
|
| 49 |
+
|
| 50 |
+
The take-home is [`Examples/UpscaleDemo/Sources/QuickStart.swift`](https://github.com/john-rocky/coreai-kit/blob/main/Examples/UpscaleDemo/Sources/QuickStart.swift)
|
| 51 |
+
β this exact code as one typed function, no UI; the CLI is an argument shell over it, and
|
| 52 |
+
the GUI runs the same resolver on the photo you pick.
|
| 53 |
+
Big photos? Inputs are tiled and feather-blended internally; `maxInputSide` (default 512)
|
| 54 |
+
caps the input first so a full-res phone photo can't produce a gigapixel result.
|
| 55 |
+
|
| 56 |
+
**Integration checklist**
|
| 57 |
+
|
| 58 |
+
- SPM: `https://github.com/john-rocky/coreai-kit` β product **CoreAIKitVision**
|
| 59 |
+
- Info.plist: none needed
|
| 60 |
+
- Entitlements: none needed
|
| 61 |
+
- First run downloads the model β 1.7 GB (Mac) / 1.7 GB (iPhone) β then it loads from the
|
| 62 |
+
local cache (Application Support; progress via the `downloadProgress` callback)
|
| 63 |
+
- Measure in Release β Debug is ~3Γ slower on per-token host work
|
| 64 |
<!-- gen-cards:use-it end -->
|
| 65 |
|
| 66 |
## What it is
|