Spaces:
Running
Running
Download source/scripts/copy-wasm.mjs from Segizu/rotoscopia-lab: direct link, hf CLI and curl.
- Browser
- Download file 775 Bytes
-
https://huggingface.co/spaces/Segizu/rotoscopia-lab/resolve/main/source/scripts/copy-wasm.mjs
- Command line
-
hf download hf://spaces/Segizu/rotoscopia-lab/source/scripts/copy-wasm.mjs
-
curl -L -o copy-wasm.mjs https://huggingface.co/spaces/Segizu/rotoscopia-lab/resolve/main/source/scripts/copy-wasm.mjs
775 Bytes
| // Copy pinned ONNX Runtime Web binaries into public/wasm so the Space self-hosts them (no third-party CDN). | |
| import { mkdirSync, copyFileSync, readFileSync } from 'node:fs'; | |
| import path from 'node:path'; | |
| const ortDir = new URL('../node_modules/onnxruntime-web/', import.meta.url).pathname; | |
| const ver = JSON.parse(readFileSync(path.join(ortDir, 'package.json'), 'utf8')).version; | |
| const out = new URL('../public/wasm/', import.meta.url).pathname; | |
| mkdirSync(out, { recursive: true }); | |
| for (const f of ['ort-wasm-simd-threaded.asyncify.mjs', 'ort-wasm-simd-threaded.asyncify.wasm', 'ort-wasm-simd-threaded.mjs', 'ort-wasm-simd-threaded.wasm']) { | |
| copyFileSync(path.join(ortDir, 'dist', f), path.join(out, f)); | |
| } | |
| console.log(`copied onnxruntime-web@${ver} wasm -> public/wasm`); | |