ocracy.tools#
Command-line tools for ocracy (dispatched via cw in __main__).
Each function here is a thin, CLI-friendly wrapper over the Python API; cw
turns their signatures into subcommands and options. Run ocracy <command>
--help (after pip install 'ocracy[cli]') or python -m ocracy <command>.
Functions
|
OCR an image and print the result. |
|
List the backends ocracy can run right now (optionally by capability). |
|
Print a backend's full ledger record as JSON. |
|
Filter the ledger and print matching backends (id, where, pricing, best-for). |
|
Generate a new backend package from its ledger entry. |
|
Smoke-test a backend adapter end to end and print the report. |
|
Show what a backend needs to run (pip, system deps, GPU, weights, creds). |
|
Report which backends are usable now, and how to install the rest. |
|
Plan (default) or run ( |
|
Print an OCR-backend readiness table (levels: all ⊇ implemented ⊇ set_up ⊇ tested). |
- ocracy.tools.backends(*, capability=None)[source]#
List the backends ocracy can run right now (optionally by capability).
- ocracy.tools.find(*, local=False, remote=False, free=False, implemented=False, handwriting=False, math=False, tables=False, language=None)[source]#
Filter the ledger and print matching backends (id, where, pricing, best-for).
Flags compose (AND). Example:
ocracy find --local --free --handwriting.- Parameters:
local (
bool) – Keep only backends that run locally.remote (
bool) – Keep only hosted/remote backends.free (
bool) – Keep only free / open-source backends.implemented (
bool) – Keep only backends ocracy can run today.handwriting (
bool) – Keep only backends that read handwriting.math (
bool) – Keep only backends that read math/formulas.tables (
bool) – Keep only backends that extract tables.language (
Optional[str]) – Keep only backends whose languages mention this name/code.
- ocracy.tools.info(backend_id)[source]#
Print a backend’s full ledger record as JSON.
- Parameters:
backend_id (
str) – A ledger id, e.g.google-vision(seeocracy find).
- ocracy.tools.install(backend_id, *, gpu=False, yes=False)[source]#
Plan (default) or run (
--yes) the pip install for a backend.Without
--yesit prints the plan and changes nothing. System deps and GPU wheels are surfaced, not run automatically.
- ocracy.tools.read(image, *, backend=None, languages=None, output='text')[source]#
OCR an image and print the result.
- ocracy.tools.requirements(backend_id, *, gpu=False)[source]#
Show what a backend needs to run (pip, system deps, GPU, weights, creds).
- ocracy.tools.scaffold(backend_id, *, dest=None)[source]#
Generate a new backend package from its ledger entry.
- ocracy.tools.status(*, level='all', run_tests=False, names=False)[source]#
Print an OCR-backend readiness table (levels: all ⊇ implemented ⊇ set_up ⊇ tested).
- Parameters:
level (
str) – Restrict rows to a level:all|implemented|set_up|tested.run_tests (
bool) – Actually OCR-test the set-up backends — makes real API calls for set-up remotes (off by default, so a plainocracy statusnever bills you).names (
bool) – Also print, per level, a comma-separatedName (website)list.