Spaces:
Running
Running
cfahlgren1 HF Staff
convert talking pixel to a sveltekit app that runs pivo-1.4m tts in the browser
3ec6b9e Download scripts/build-kernel.mjs from cfahlgren1/talking-pixel: direct link, hf CLI and curl.
- Browser
- Download file 684 Bytes
-
https://huggingface.co/spaces/cfahlgren1/talking-pixel/resolve/main/scripts/build-kernel.mjs
- Command line
-
hf download hf://spaces/cfahlgren1/talking-pixel/scripts/build-kernel.mjs
-
curl -L -o build-kernel.mjs https://huggingface.co/spaces/cfahlgren1/talking-pixel/resolve/main/scripts/build-kernel.mjs
684 Bytes
| // Compile kernel/matvec.wat to a base64 module embedded in src/lib/kernel-wasm.ts. | |
| import { readFileSync, writeFileSync } from 'node:fs'; | |
| import wabtInit from 'wabt'; | |
| const wabt = await wabtInit(); | |
| const src = readFileSync(new URL('../kernel/matvec.wat', import.meta.url), 'utf8'); | |
| const mod = wabt.parseWat('matvec.wat', src, { simd: true }); | |
| const { buffer } = mod.toBinary({}); | |
| const b64 = Buffer.from(buffer).toString('base64'); | |
| writeFileSync(new URL('../src/lib/kernel-wasm.ts', import.meta.url), | |
| `// Generated by tools/build_kernel.mjs from kernel/matvec.wat. Do not edit.\nexport const MATVEC_WASM_BASE64 = '${b64}';\n`); | |
| console.log('matvec.wasm', buffer.length, 'bytes'); | |