Python API¶
Kind: reference.
This page renders the experiment's Python docstrings and signatures from source. These interfaces support the current experiment. They do not promise a stable public API. Use Commands and scoring to run the receipt workflow.
The modules below cover receipt metrics, inference requests, synthetic sweeps, synthetic inputs, container ownership, optional service handover and CLI output. The source docstrings define each function's behavior and limits.
inference_lab.receipt_metrics
¶
Measure diagnostic overlap against partial CORD annotations.
These metrics are not official CORD scores. They do not assess layout or associate extracted amounts with financial fields.
Attributes:
| Name | Type | Description |
|---|---|---|
TOKEN |
Pattern preserving numeric punctuation while extracting word tokens. |
|
CONTROL |
Pattern matching known Nemotron control tokens. |
Examples:
from inference_lab.receipt_metrics import score
recall = score("Total 12.00", "total 12.00")["numeric_recall"] # 1.0
See Also
inference_lab.client: HTTP extraction and request status accounting.
numbers(text: str) -> Counter
¶
Count exact numeric strings, including repeated occurrences.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
text
|
str
|
Reference or predicted text. |
required |
Returns:
| Type | Description |
|---|---|
Counter
|
Counts keyed by numeric token; punctuation and signs remain significant. |
Source code in src/inference_lab/receipt_metrics.py
59 60 61 62 63 64 65 66 67 68 | |
plain_text(raw: str) -> str
¶
Strip model markup and collapse whitespace for diagnostic scoring.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
raw
|
str
|
Model output containing control tokens, markup or LaTeX commands. |
required |
Returns:
| Type | Description |
|---|---|
str
|
Unescaped text with markup removed and whitespace collapsed. |
Source code in src/inference_lab/receipt_metrics.py
30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 | |
score(reference: str, prediction: str) -> dict
¶
Calculate token ROUGE-L and exact numeric-string recall.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
reference
|
str
|
Partial annotated text used as the comparison target. |
required |
prediction
|
str
|
Extracted plain text to compare with the reference. |
required |
Returns:
| Type | Description |
|---|---|
dict
|
Token precision, recall and F1; numeric match counts and recall; and |
dict
|
unmatched reference numeric strings. Recall and F1 are None for an |
dict
|
empty reference. Numeric recall is None when it contains no numbers. |
Source code in src/inference_lab/receipt_metrics.py
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 | |
tokens(text: str) -> list[str]
¶
Extract casefolded word and numeric tokens.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
text
|
str
|
Reference or predicted text. |
required |
Returns:
| Type | Description |
|---|---|
list[str]
|
Tokens in source order, with numeric punctuation preserved. |
Source code in src/inference_lab/receipt_metrics.py
47 48 49 50 51 52 53 54 55 56 | |
inference_lab.client
¶
Send one prepared image per bounded HTTP request without retries.
Attributes:
| Name | Type | Description |
|---|---|---|
PROMPT |
Control tokens for Nemotron layout and text extraction. |
|
MODEL |
Model name exposed by the demo server. |
Examples:
Normalize expected text for a case-insensitive sanity check:
from inference_lab.client import normalized
text = normalized("Total: 12.00") # "total 12 00"
See Also
inference_lab.experiment: Preparation and measured concurrency sweeps.
Page
dataclass
¶
Hold an image prepared outside the measured request interval.
Attributes:
| Name | Type | Description |
|---|---|---|
name |
str
|
Source image filename used in request records. |
sha256 |
str
|
SHA-256 digest of the original file bytes. |
data_url |
str
|
Base64 PNG data URL submitted to the server. |
expected |
tuple[str, ...]
|
Text snippets required by the synthetic quality check. |
Examples:
Prepare a real image rather than constructing its data URL manually:
from pathlib import Path
from inference_lab.client import prepare
page = prepare(Path("corpus/page-01.png"), ("LAB401",))
Source code in src/inference_lab/client.py
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 | |
infer(client: httpx.AsyncClient, page: Page, timeout: float) -> dict
async
¶
Return one terminal record, including failure and observed latency.
HTTP, timeout and malformed-response failures become records rather than escaping to the caller. Task cancellation still propagates.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
client
|
AsyncClient
|
Async HTTP client configured with the server base URL. |
required |
page
|
Page
|
Image and expected text prepared before timing. |
required |
timeout
|
float
|
Total request deadline in seconds. |
required |
Returns:
| Type | Description |
|---|---|
dict
|
Record with page name, digest, status, text and latency in seconds. |
dict
|
Failure records include an error description. |
Source code in src/inference_lab/client.py
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 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 | |
normalized(text: str) -> str
¶
Casefold text and join word tokens with single spaces.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
text
|
str
|
Expected or extracted text. |
required |
Returns:
| Type | Description |
|---|---|
str
|
Normalized text for substring sanity checks. |
Source code in src/inference_lab/client.py
87 88 89 90 91 92 93 94 95 96 | |
prepare(path: Path, expected: tuple[str, ...] = ()) -> Page
¶
Decode and normalize before inference timing begins.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
path
|
Path
|
Image file to read and convert to RGB PNG. |
required |
expected
|
tuple[str, ...]
|
Required text snippets for response validation. |
()
|
Returns:
| Type | Description |
|---|---|
Page
|
Prepared image with the original file digest and encoded PNG. |
Source code in src/inference_lab/client.py
63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 | |
inference_lab.experiment
¶
Run finite closed-loop sweeps with explicit result accounting.
Examples:
Summarize observed latencies without claiming tail percentiles:
from inference_lab.experiment import distribution
median = distribution([1.0, 2.0, 3.0])["median_s"] # 2.0 seconds
See Also
inference_lab.client: Request preparation and response validation.
inference_lab.corpus: Synthetic inputs with known expected text.
distribution(values: list[float]) -> dict
¶
Summarize small samples with minimum, median and maximum latency.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
values
|
list[float]
|
Observed request latencies in seconds. |
required |
Returns:
| Type | Description |
|---|---|
dict
|
Count and latency statistics; all statistics are None for no samples. |
Source code in src/inference_lab/experiment.py
29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 | |
load_corpus(directory: Path) -> list[Page]
¶
Load and prepare the synthetic corpus described by its manifest.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
directory
|
Path
|
Directory containing manifest.json and its image files. |
required |
Returns:
| Type | Description |
|---|---|
list[Page]
|
Prepared images in manifest order with required text snippets. |
Raises:
| Type | Description |
|---|---|
ValueError
|
An image escapes the corpus directory, expected text is missing or invalid, or the manifest contains no pages. |
Source code in src/inference_lab/experiment.py
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 | |
render(report: dict) -> str
¶
Render a sweep report as Markdown with timing limits and metadata.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
report
|
dict
|
Report containing sweeps and metadata; each sweep must have nonempty latency observations. |
required |
Returns:
| Type | Description |
|---|---|
str
|
Markdown summary table and JSON configuration block. |
Source code in src/inference_lab/experiment.py
145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 | |
summarize(records: list[dict], elapsed: float, concurrency: int) -> dict
¶
Count every terminal status and summarize throughput and latency.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
records
|
list[dict]
|
Request records with status and latency_s fields. |
required |
elapsed
|
float
|
Wall-clock sweep duration in seconds. |
required |
concurrency
|
int
|
Worker limit used by the sweep. |
required |
Returns:
| Type | Description |
|---|---|
dict
|
Completion and failure counts, status counts, throughput, and latency |
dict
|
distributions for all requests and successful requests separately. |
Source code in src/inference_lab/experiment.py
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 | |
sweep(client: httpx.AsyncClient, pages: list[Page], concurrency: int, timeout: float) -> dict
async
¶
Submit each prepared page once through a bounded worker pool.
Preparation and warmup belong outside this measured sweep. Worker tasks share one iterator, so a page is assigned to exactly one worker.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
client
|
AsyncClient
|
Async HTTP client configured with the parser base URL. |
required |
pages
|
list[Page]
|
Nonempty sequence of prepared images. |
required |
concurrency
|
int
|
Worker limit, one of 1, 2, 4 or 8. |
required |
timeout
|
float
|
Deadline in seconds for each request. |
required |
Returns:
| Type | Description |
|---|---|
dict
|
Sweep summary and terminal request records in input order. |
Raises:
| Type | Description |
|---|---|
ValueError
|
Pages are empty or concurrency is unsupported. |
Source code in src/inference_lab/experiment.py
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 | |
inference_lab.corpus
¶
Generate eight original, deterministic RGB documents with known text.
Examples:
Create a corpus in a chosen output directory:
from pathlib import Path
from inference_lab.corpus import generate
count = generate(Path("corpus"))
See Also
inference_lab.experiment.load_corpus: Read and prepare generated images.
generate(directory: Path) -> int
¶
Write synthetic page images and their expected-text manifest.
Existing generated filenames and the manifest are replaced.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
directory
|
Path
|
Destination directory, created with any missing parents. |
required |
Returns:
| Type | Description |
|---|---|
int
|
Number of generated pages, always eight. |
Source code in src/inference_lab/corpus.py
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 | |
inference_lab.serving
¶
Inspect and manage only this checkout's labelled Podman container.
The profile in serving/config.json supplies the image, GPU memory floor and
server arguments. Ownership checks precede container mutations. This module
never stops unrelated GPU workloads.
Examples:
Read the checked-in profile without contacting the GPU or Podman:
from inference_lab import serving
profile = serving.config()
print(profile["container"])
See Also
inference_lab.local_gpu: Explicit opt-in service handover and restoration.
command(argv: list[str], timeout: float = 20) -> str
¶
Run a local tool with captured output and a deadline.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
argv
|
list[str]
|
Trusted executable and arguments, passed directly without a shell. |
required |
timeout
|
float
|
Maximum execution time in seconds. |
20
|
Returns:
| Type | Description |
|---|---|
str
|
Standard output with leading and trailing whitespace removed. |
Raises:
| Type | Description |
|---|---|
RuntimeError
|
If the tool exits unsuccessfully; includes bounded stderr. |
TimeoutExpired
|
If execution exceeds the deadline. |
OSError
|
If the executable cannot be started. |
Source code in src/inference_lab/serving.py
46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 | |
config() -> dict
¶
Read the checkout's runtime profile.
Returns:
| Type | Description |
|---|---|
dict
|
Parsed settings from |
Raises:
| Type | Description |
|---|---|
OSError
|
If the profile cannot be read. |
JSONDecodeError
|
If the profile is not valid JSON. |
Source code in src/inference_lab/serving.py
33 34 35 36 37 38 39 40 41 42 43 | |
gpu() -> dict
¶
Query GPU zero with nvidia-smi.
Returns:
| Type | Description |
|---|---|
dict
|
String values for name, UUID, driver, memory in MiB and utilization. |
Raises:
| Type | Description |
|---|---|
RuntimeError
|
If nvidia-smi exits unsuccessfully. |
ValueError
|
If the response does not contain the expected fields. |
Source code in src/inference_lab/serving.py
70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 | |
inspect() -> dict | None
¶
Inspect the configured container after verifying checkout ownership.
Returns:
| Type | Description |
|---|---|
dict | None
|
Podman inspection data, or None when the container is absent. |
Raises:
| Type | Description |
|---|---|
RuntimeError
|
If Podman fails or the name belongs to another checkout. |
See Also
stop: Remove only the inspected immutable ID.
Source code in src/inference_lab/serving.py
92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 | |
start() -> dict
¶
Start the owned parser container and wait up to 300 seconds for readiness.
An existing running container is reported without a new readiness check. A failed readiness check leaves the container available for log inspection. Keyboard interruption after launch removes the owned container.
Returns:
| Type | Description |
|---|---|
dict
|
Container name and readiness or already-running status. |
Raises:
| Type | Description |
|---|---|
RuntimeError
|
If ownership, free memory, startup or readiness checks fail. |
TimeoutExpired
|
If a local tool exceeds its deadline. |
KeyboardInterrupt
|
If startup is interrupted; cleanup runs after launch. |
See Also
stop: Remove a failed container after inspecting its logs.
Source code in src/inference_lab/serving.py
130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 | |
status() -> dict
¶
Collect container state and GPU information.
Returns:
| Type | Description |
|---|---|
dict
|
Container state, including |
Raises:
| Type | Description |
|---|---|
RuntimeError
|
If ownership verification or a local tool fails. |
Source code in src/inference_lab/serving.py
117 118 119 120 121 122 123 124 125 126 127 | |
stop() -> dict
¶
Remove the owned parser container by its inspected immutable ID.
Returns:
| Type | Description |
|---|---|
dict
|
Removal status, or |
Raises:
| Type | Description |
|---|---|
RuntimeError
|
If ownership verification or removal fails. |
Source code in src/inference_lab/serving.py
208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 | |
inference_lab.local_gpu
¶
Provide opt-in GPU service handover with durable restoration evidence.
The context manager preserves the prior service state and loaded model IDs. Callers must explicitly enable handover before this module changes services. Disabled handover leaves the caller's server lifecycle unchanged.
Examples:
Disable handover when using an already managed parser server:
from pathlib import Path
from inference_lab.local_gpu import parser_session
with parser_session(Path("runs/example"), enabled=False):
pass
See Also
inference_lab.serving: Container ownership and free-memory safeguards.
loaded_models(client: httpx.Client) -> list[str]
¶
Read loaded model IDs from a router in a stable state.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
client
|
Client
|
HTTP client configured with the router's base URL. |
required |
Returns:
| Type | Description |
|---|---|
list[str]
|
IDs whose router state is |
Raises:
| Type | Description |
|---|---|
RuntimeError
|
If any model is neither loaded nor unloaded. |
HTTPError
|
If the router request fails. |
KeyError
|
If the response lacks required model fields. |
Source code in src/inference_lab/local_gpu.py
50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 | |
parser_session(output: Path, enabled: bool) -> Generator[None]
¶
Temporarily run the parser and restore the previous user service state.
Disabled sessions yield without inspecting or modifying services. Enabled sessions record initial state before stopping anything. Cleanup attempts parser removal and service restoration even if the experiment fails. Restoration failures are recorded and raised, including during unwinding.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
output
|
Path
|
Existing run directory for a new |
required |
enabled
|
bool
|
Explicit authorization to perform the local service handover. |
required |
Yields:
| Type | Description |
|---|---|
Generator[None]
|
None while the caller runs its experiment. |
Raises:
| Type | Description |
|---|---|
RuntimeError
|
If ownership, service state, startup or restoration fails. |
OSError
|
If the audit file or local commands cannot be accessed. |
HTTPError
|
If the initial model-state request fails. |
TimeoutExpired
|
If a local lifecycle command times out. |
See Also
restore_models: Verify model identities. inference_lab.serving.start: Start only the owned parser container.
Source code in src/inference_lab/local_gpu.py
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 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 | |
restore_models(client: httpx.Client, models: list[str], timeout: float = 180) -> None
¶
Wait for router health, load previous models and verify their identities.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
client
|
Client
|
HTTP client configured with the router's base URL. |
required |
models
|
list[str]
|
Previously loaded model IDs to restore. |
required |
timeout
|
float
|
Shared deadline in seconds for health, loading and verification. |
180
|
Raises:
| Type | Description |
|---|---|
RuntimeError
|
If readiness or model restoration exceeds the deadline. |
HTTPError
|
If loading or model verification requests fail. |
KeyError
|
If the router response lacks required model fields. |
Source code in src/inference_lab/local_gpu.py
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 | |
service(action: str) -> None
¶
Apply an action to the configured user service.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
action
|
str
|
systemctl action, such as |
required |
Raises:
| Type | Description |
|---|---|
RuntimeError
|
If systemctl exits unsuccessfully. |
TimeoutExpired
|
If the command exceeds 60 seconds. |
Source code in src/inference_lab/local_gpu.py
37 38 39 40 41 42 43 44 45 46 47 | |
inference_lab.cli
¶
Run parsing experiments with compact status views and JSON evidence.
Examples:
Inspect the available commands without starting a server:
from inference_lab.cli import parser
print(parser().format_help())
See Also
Parser
¶
Bases: ArgumentParser
Report argument errors in the same flat format as command results.
Examples:
Parse options without contacting hardware:
from inference_lab.cli import parser
options = parser().parse_args(["logs", "--full"])
assert options.full
Source code in src/inference_lab/cli.py
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 | |
error(message: str)
¶
Print argument guidance and exit with usage status two.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
message
|
str
|
The argument parser's diagnostic. |
required |
Raises:
| Type | Description |
|---|---|
SystemExit
|
Always, with exit status two. |
Source code in src/inference_lab/cli.py
100 101 102 103 104 105 106 107 108 109 110 111 | |
emit(data: dict) -> None
¶
Print a flat status mapping to standard output.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
data
|
dict
|
Ordered keys and scalar values to display. |
required |
Source code in src/inference_lab/cli.py
75 76 77 78 79 80 81 82 83 | |
main() -> int
¶
Dispatch a command and report recoverable failures as status views.
Returns:
| Type | Description |
|---|---|
int
|
Zero on success, one on command failure, or 130 on interruption. |
Raises:
| Type | Description |
|---|---|
SystemExit
|
Argument parsing requests help or rejects usage. |
Source code in src/inference_lab/cli.py
373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 410 411 412 413 414 415 416 417 418 419 420 421 422 423 424 425 426 | |
parser() -> Parser
¶
Build the argument parser without probing the host or GPU.
Returns:
| Type | Description |
|---|---|
Parser
|
The parser with all supported subcommands. |
Source code in src/inference_lab/cli.py
133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 | |
positive(value: str) -> float
¶
Parse a finite, strictly positive timeout.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
value
|
str
|
Numeric command-line argument. |
required |
Returns:
| Type | Description |
|---|---|
float
|
The parsed timeout in seconds. |
Raises:
| Type | Description |
|---|---|
ValueError
|
The input is not numeric. |
ArgumentTypeError
|
The value is nonpositive or nonfinite. |
Source code in src/inference_lab/cli.py
114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 | |
run_bench(args: argparse.Namespace) -> int
async
¶
Warm the corpus and record bounded concurrency sweeps.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
args
|
Namespace
|
Parsed benchmark options and a new output directory. |
required |
Returns:
| Type | Description |
|---|---|
int
|
Zero if every measured request succeeds, otherwise one. |
Raises:
| Type | Description |
|---|---|
RuntimeError
|
The owned server is unavailable or a warmup fails. |
ValueError
|
The URL differs from the managed server. |
BaseException
|
Run failures propagate after partial evidence is saved. |
Source code in src/inference_lab/cli.py
214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 | |
run_ocr(args: argparse.Namespace) -> int
async
¶
Extract one image and save its text and terminal request record.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
args
|
Namespace
|
Parsed OCR options, including input, output, URL and timeout. |
required |
Returns:
| Type | Description |
|---|---|
int
|
Zero for a successful request, otherwise one. |
Source code in src/inference_lab/cli.py
171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 | |
scalar(value: str | int | float | bool | None) -> str
¶
Encode one scalar for the CLI's flat TOON views.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
value
|
str | int | float | bool | None
|
A string or JSON-compatible scalar. |
required |
Returns:
| Type | Description |
|---|---|
str
|
A quoted or bare scalar with control characters escaped. |
Source code in src/inference_lab/cli.py
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 | |
inference_lab
¶
Provide the local Nemotron OCR demonstration and receipt diagnostics.
Attributes:
| Name | Type | Description |
|---|---|---|
client |
Image preparation and bounded inference requests. |
|
corpus |
Synthetic document generation. |
|
experiment |
Closed-loop sweeps and result summaries. |
|
receipt_metrics |
Diagnostic text and numeric-string comparison. |
Examples:
Compare text without starting a GPU server:
from inference_lab.receipt_metrics import score
recall = score("Total 12.00", "Total 12.00")["numeric_recall"] # 1.0
See Also
inference_lab.cli: Command-line entry point.
inference_lab.serving: Owned-container lifecycle and resource checks.