ezgh ocr batches create --processor <processor> <files…|dir> [--name n] [--parallel 4] [--wait] [--download <dir>] [--strict] [flags]Create a batch of documents and submit it. A directory’s PDF, PNG, JPEG, TIFF and WebP documents are all taken, in its subdirectories too (hidden files aside; anything else is skipped with a note); a document named on the command line must be one of those types. Everything is checked here first, against the model’s limits and the batch’s (1,000 documents, 5 GiB).
ezgh creates a draft batch, then uploads the documents --parallel at a time (4 by default, 8 at most), streaming each from disk, with its progress. A failed upload is tried again, always with the same Idempotency-Key, so a document the service already has is never added twice. Then it submits the batch, with a warning when the page quota may run out before every document starts: a document that can’t start then fails with quota_exceeded.
If uploading is interrupted, run the same command with --batch <batch>: documents already in the batch (matched by SHA-256) are skipped, the rest uploaded, and the batch submitted. A draft is deleted 24 hours after it’s created.
--wait waits for the batch, showing pages done out of the total; --download <dir> (which waits too) then saves each document’s output in dir. Ctrl-C stops waiting; the batch keeps running.
Exit codes, with --wait: 0 when the batch succeeded, or partially succeeded (some pages or documents failed) unless --strict, which makes that 1; 1 when it failed or was cancelled; 6 when documents failed because the page quota ran out (quota_exceeded). Any quota refusal exits 6.
Part of ezgh ocr batches.
Examples
ezgh ocr batches create --processor receipts scans/
ezgh ocr batches create --processor forms a.pdf b.pdf c.png --name march --wait
ezgh ocr batches create --processor receipts scans/ --download out/ --strict
ezgh ocr batches create --batch obt_k3f9a0x2m7qp scans/ # resume an interrupted uploadFlags
| Flag | Type | Default | Description |
|---|---|---|---|
--batch |
string | resume this draft batch (ID, slug or name): skip what it has, upload the rest, submit it | |
--download |
string | wait, then save each document’s output in this directory | |
--name |
string | a name for the batch | |
--parallel |
int | 4 |
documents uploaded at a time, 1 to 8 |
--processor |
string | the processor, by ID, slug or name (required unless --batch) |
|
--strict |
boolean | with --wait, exit 1 when any page or document failed |
|
--wait |
boolean | wait for the batch to finish, showing its progress |
This command also takes the global flags.