/** * 模型加载器(Backend 抽象 + 模型共享缓存) * Phase B 重构:消除 TF/ONNX 分支硬编码,统一接口 */ import type { PaddleOcrOptions } from "../typings"; import { ModelType } from "./modelPath"; /** 后端类型 */ export type BackendKind = "tensorflow" | "onnx"; export interface LoadedModel { predict(input: unknown): Promise; run?(feeds: Record): Promise>; dispose?(): void; } export interface ModelSpec { type: ModelType; name?: string; language?: string; subPath?: string; } export declare class ModelLoader { private cache; private backend; private basePath; constructor(options: PaddleOcrOptions); /** 加载模型(自动缓存) */ load(spec: ModelSpec): Promise; /** 释放所有模型 */ dispose(): void; }