Files
ai-spel-frontend/piper-onnx-config.mjs
T
Ein Anderssono a4f89f2b82
Build and publish frontend / publish (push) Successful in 50s
Use single-thread ONNX runtime for mobile speech
2026-10-16 08:51:08 +02:00

15 lines
514 B
JavaScript

const assetRoot = '/static/piper-wasm-v1/onnx/';
export function createOnnxWasmPaths(origin) {
const absoluteAssetRoot = new URL(assetRoot, origin).href;
return absoluteAssetRoot;
}
export function configureOnnxRuntime(onnxRuntime) {
if (!onnxRuntime?.env?.wasm) throw new TypeError('ONNX Runtime WebAssembly settings are unavailable.');
// Piper already runs in a worker. Avoid a second worker pool on mobile Safari.
onnxRuntime.env.wasm.numThreads = 1;
onnxRuntime.env.wasm.initTimeout = 60000;
}