openwakeword-js 0.1.18 → 0.1.19
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/index.html +1 -1
- package/package.json +1 -1
- package/scripts/download_models.js +20 -17
package/index.html
CHANGED
|
@@ -286,7 +286,7 @@
|
|
|
286
286
|
class="h-44 overflow-y-auto rounded-xl bg-[#030406] p-4 font-mono text-[10px] text-slate-600 border border-white/5 custom-scrollbar leading-relaxed">
|
|
287
287
|
<div
|
|
288
288
|
class="opacity-40 animate-pulse font-bold text-blue-900 border border-blue-900/40 p-1 inline-block rounded mb-2">
|
|
289
|
-
OPENWAKEWORD-JS V0.1.
|
|
289
|
+
OPENWAKEWORD-JS V0.1.18 READY</div>
|
|
290
290
|
</div>
|
|
291
291
|
</div>
|
|
292
292
|
</details>
|
package/package.json
CHANGED
|
@@ -8,14 +8,14 @@ const __dirname = path.dirname(fileURLToPath(import.meta.url));
|
|
|
8
8
|
const packageRoot = path.join(__dirname, '..');
|
|
9
9
|
const MODELS_DIR = path.join(process.cwd(), 'models');
|
|
10
10
|
|
|
11
|
-
const
|
|
11
|
+
const EXTERNAL_MODELS = {
|
|
12
12
|
'melspectrogram.onnx': 'https://github.com/dscripka/openWakeWord/releases/download/v0.5.1/melspectrogram.onnx',
|
|
13
13
|
'embedding_model.onnx': 'https://github.com/dscripka/openWakeWord/releases/download/v0.5.1/embedding_model.onnx',
|
|
14
|
-
'silero_vad.onnx': 'https://github.com/dscripka/openWakeWord/releases/download/v0.5.1/silero_vad.onnx'
|
|
15
|
-
'hello_deepa.onnx': 'https://github.com/Firojpaudel/OpenWakeWord_npm_porting/raw/main/models/hello_deepa.onnx',
|
|
16
|
-
'namaste_deepa.onnx': 'https://github.com/Firojpaudel/OpenWakeWord_npm_porting/raw/main/models/namaste_deepa.onnx'
|
|
14
|
+
'silero_vad.onnx': 'https://github.com/dscripka/openWakeWord/releases/download/v0.5.1/silero_vad.onnx'
|
|
17
15
|
};
|
|
18
16
|
|
|
17
|
+
const SAMPLE_MODELS = ['hello_deepa.onnx', 'namaste_deepa.onnx'];
|
|
18
|
+
|
|
19
19
|
async function downloadFile(url, dest) {
|
|
20
20
|
return new Promise((resolve, reject) => {
|
|
21
21
|
https.get(url, (response) => {
|
|
@@ -55,8 +55,8 @@ async function main() {
|
|
|
55
55
|
console.log(`Created directory: ${MODELS_DIR}`);
|
|
56
56
|
}
|
|
57
57
|
|
|
58
|
-
console.log('
|
|
59
|
-
for (const [name, url] of Object.entries(
|
|
58
|
+
console.log('Deploying base neural model binaries...');
|
|
59
|
+
for (const [name, url] of Object.entries(EXTERNAL_MODELS)) {
|
|
60
60
|
const dest = path.join(MODELS_DIR, name);
|
|
61
61
|
if (fs.existsSync(dest) && fs.statSync(dest).size > 1000000) {
|
|
62
62
|
console.log(`- ${name} already exists and validated, skipping.`);
|
|
@@ -70,34 +70,37 @@ async function main() {
|
|
|
70
70
|
console.log(`Failed: ${err.message}`);
|
|
71
71
|
}
|
|
72
72
|
}
|
|
73
|
-
|
|
73
|
+
|
|
74
|
+
console.log('\nDeploying sample wake-word models from package...');
|
|
75
|
+
for (const name of SAMPLE_MODELS) {
|
|
76
|
+
const src = path.join(packageRoot, 'models', name);
|
|
77
|
+
const dest = path.join(MODELS_DIR, name);
|
|
78
|
+
copyIfExists(src, dest, 'Sample Model');
|
|
79
|
+
}
|
|
74
80
|
|
|
75
81
|
console.log('\nDeploying ONNX Runtime WebAssembly environment...');
|
|
76
82
|
const nodeModulesPath = path.join(process.cwd(), 'node_modules', 'onnxruntime-web', 'dist');
|
|
77
83
|
|
|
78
84
|
if (fs.existsSync(nodeModulesPath)) {
|
|
79
|
-
// Copy EVERYTHING starting with ort-wasm to ensure all loaders/workers are present
|
|
80
85
|
const runtimeFiles = fs.readdirSync(nodeModulesPath).filter(f =>
|
|
81
86
|
f.startsWith('ort-wasm') && (f.endsWith('.wasm') || f.endsWith('.mjs') || f.endsWith('.js'))
|
|
82
87
|
);
|
|
83
88
|
for (const file of runtimeFiles) {
|
|
84
89
|
copyIfExists(path.join(nodeModulesPath, file), path.join(MODELS_DIR, file), 'RUNTIME');
|
|
85
90
|
}
|
|
86
|
-
|
|
87
|
-
|
|
91
|
+
// Also copy the main entry point if not already there
|
|
92
|
+
copyIfExists(path.join(nodeModulesPath, 'ort.mjs'), path.join(MODELS_DIR, 'ort.mjs'), 'RUNTIME_ENTRY');
|
|
88
93
|
}
|
|
89
94
|
|
|
90
95
|
console.log('\nDeploying optimized AI Listening Interface...');
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
copyIfExists(exampleHtml, destHtml, 'UI');
|
|
96
|
+
copyIfExists(path.join(packageRoot, 'index.html'), path.join(process.cwd(), 'index.html'), 'UI');
|
|
97
|
+
copyIfExists(path.join(packageRoot, 'openwakeword.mjs'), path.join(process.cwd(), 'openwakeword.mjs'), 'Library');
|
|
94
98
|
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
copyIfExists(libSrc, libDest, 'Library');
|
|
99
|
+
// Copy test.html too
|
|
100
|
+
copyIfExists(path.join(packageRoot, 'models', 'test.html'), path.join(MODELS_DIR, 'test.html'), 'Debug UI');
|
|
98
101
|
|
|
99
102
|
console.log('\n----------------------------------------------------');
|
|
100
|
-
console.log('SETUP COMPLETE (v0.1.
|
|
103
|
+
console.log('SETUP COMPLETE (v0.1.18)');
|
|
101
104
|
console.log('----------------------------------------------------');
|
|
102
105
|
console.log('Your precision AI wake word interface is ready.');
|
|
103
106
|
console.log('\nTo start the demo:');
|