parent
cfc06bf8df
commit
1ca8edf87f
@ -0,0 +1,28 @@
|
|||||||
|
rm -rf ./build
|
||||||
|
rm -rf ./examples/addon.node/whisper
|
||||||
|
|
||||||
|
npx cmake-js compile -T whisper-addon
|
||||||
|
|
||||||
|
mkdir ./examples/addon.node/whisper
|
||||||
|
cp ./build/Release/* ./examples/addon.node/whisper
|
||||||
|
|
||||||
|
rm -rf ./build
|
||||||
|
|
||||||
|
cd ./examples/addon.node
|
||||||
|
node ./index.js --model=../../models/tiny.en.bin --fname_inp=../../samples/jfk.wav
|
||||||
|
|
||||||
|
# pkg index.js --target node16-macos-arm64
|
||||||
|
|
||||||
|
# rm ./whisper/addon.node
|
||||||
|
|
||||||
|
# ./index --model=../../models/tiny.en.bin --fname_inp=../../samples/jfk.wav
|
||||||
|
|
||||||
|
# cd ..
|
||||||
|
|
||||||
|
# ./addon.node/index --model=../models/tiny.en.bin --fname_inp=../samples/jfk.wav
|
||||||
|
|
||||||
|
# cp ./index ../../index
|
||||||
|
|
||||||
|
# cd ../..
|
||||||
|
|
||||||
|
# ./index --model=./models/tiny.en.bin --fname_inp=./samples/jfk.wav
|
@ -1,27 +1,26 @@
|
|||||||
const path = require('path');
|
|
||||||
const { whisper } = require(path.join(__dirname, '../../build/Release/whisper-addon'));
|
|
||||||
|
|
||||||
const whisperParams = {
|
|
||||||
language: 'en',
|
|
||||||
model: path.join(__dirname, '../../models/ggml-base.en.bin'),
|
|
||||||
fname_inp: '',
|
|
||||||
};
|
|
||||||
|
|
||||||
const arguments = process.argv.slice(2);
|
const arguments = process.argv.slice(2);
|
||||||
const params = Object.fromEntries(
|
const params = Object.fromEntries(
|
||||||
arguments.reduce((pre, item) => {
|
arguments.reduce((pre, item) => {
|
||||||
if (item.startsWith("--")) {
|
if (item.startsWith("--")) {
|
||||||
return [...pre, item.slice(2).split("=")];
|
return [...pre, item.slice(2).split("=")];
|
||||||
}
|
}
|
||||||
return pre;
|
return pre;
|
||||||
}, []),
|
}, [])
|
||||||
);
|
);
|
||||||
|
|
||||||
|
const { whisper } = require(params.whisper);
|
||||||
|
|
||||||
|
const whisperParams = {
|
||||||
|
language: "en",
|
||||||
|
model: "",
|
||||||
|
fname_inp: "",
|
||||||
|
};
|
||||||
|
|
||||||
for (const key in params) {
|
for (const key in params) {
|
||||||
if (whisperParams.hasOwnProperty(key)) {
|
if (whisperParams.hasOwnProperty(key)) {
|
||||||
whisperParams[key] = params[key];
|
whisperParams[key] = params[key];
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
console.log('whisperParams =', whisperParams);
|
console.log("whisperParams =", whisperParams);
|
||||||
console.log(whisper(whisperParams));
|
console.log(whisper(whisperParams));
|
||||||
|
File diff suppressed because it is too large
Load Diff
Loading…
Reference in new issue