import { type DeviceType, RawImage } from '@huggingface/transformers'; /** * Build the `from_pretrained` option objects (processor + model) with the * pinned dtype and resolved device. transformers.js declares `dtype` as a * literal union; cast through `unknown` to widen-to-string-then-back. */ export declare function buildModelLoadOptions(resolvedDevice: string): { dtypeOpt: { dtype: 'q4'; }; modelOpt: { dtype: 'q4'; device: DeviceType; }; }; /** The processor + model pair produced by a profile's load callback. */ export interface LoadedModel { processor: unknown; model: unknown; } /** * Lazy model loader shared by both profiles. Encapsulates the * pending→ok/failed state machine and the identical load-failure wrapping * (`Captioner load failed (modelName=..., device=...)`). The per-profile * `load` callback owns the model-class choice and receives the shared option * objects. On first `ensureLoaded()` the model loads; subsequent calls return * the cached pair; a prior failure re-throws the same wrapped error. */ export declare function createModelLoader(modelName: string, resolvedDevice: string, load: (opts: ReturnType) => Promise): { ensureLoaded: () => Promise; }; /** * Decode PNG bytes to a `RawImage`. `Blob` accepts `Uint8Array` directly (the * renderer returns `Uint8Array` from `Pixmap.asPNG()`), but the `BlobPart` * type omits `Uint8Array` due to SharedArrayBuffer subtyping; * cast through `unknown`. Profiles needing a fixed input size resize the result. */ export declare function decodePngToRawImage(pngBytes: Uint8Array): Promise; /** * Apply the post-generation processing rules. Returns the final caption or * `null` when the result is empty after stripping. */ export declare function postProcess(decoded: string): string | null; //# sourceMappingURL=shared.d.ts.map