(config?: Config)
| 9 | import { convertFloat32ToUint8 } from './utils'; |
| 10 | |
| 11 | async function initInference(config?: Config) { |
| 12 | config = validateConfig(config); |
| 13 | |
| 14 | if (config.debug) console.debug('Loading model...'); |
| 15 | const model = config.model; |
| 16 | const blob = await loadAsBlob(`/models/${model}`, config); |
| 17 | const arrayBuffer = await blob.arrayBuffer(); |
| 18 | const session = await createOnnxSession(arrayBuffer, config); |
| 19 | return { config, session }; |
| 20 | } |
| 21 | |
| 22 | async function runInference( |
| 23 | imageTensor: NdArray<Uint8Array>, |
nothing calls this directly
no test coverage detected