UNPKG

@sconedev/ai_toolkit

Version:

Simplify AI integration in web apps with local and offline model support

40 lines (39 loc) 1.46 kB
import { OnnxModelConfig } from "./onnxRuntime"; /** * Run inference using local model file in browser * * @param modelFile File from file input or drop * @param modelConfig Model configuration * @param inputData Input data for inference * @param options Additional options */ export declare function runModelFromFile(modelFile: File, modelConfig: OnnxModelConfig, inputData: Record<string, any>, options?: { cacheResults?: boolean; cacheModel?: boolean; progressCallback?: (progress: number) => void; inferenceOptions?: Record<string, any>; }): Promise<Record<string, any>>; /** * Load a model from URL with caching support * Useful for offline-first applications */ export declare function runOnnxInferenceBrowser(modelConfig: OnnxModelConfig, inputData: Record<string, any>, options?: { cacheResults?: boolean; cacheModel?: boolean; progressCallback?: (progress: number) => void; inferenceOptions?: Record<string, any>; }): Promise<Record<string, any>>; export declare function loadModelFromUrl(url: string, options?: { checkCache?: boolean; saveToCache?: boolean; saveToIndexedDB?: boolean; progressCallback?: (progress: number) => void; }): Promise<ArrayBuffer>; /** * Check if WebGPU is supported in the current browser */ export declare function isWebGPUSupported(): boolean; /** * Check if WebAssembly is supported in the current browser */ export declare function isWasmSupported(): boolean;