File size: 712 Bytes
2439857
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
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 params = Object.fromEntries(
    arguments.reduce((pre, item) => {
        if (item.startsWith("--")) {
            return [...pre, item.slice(2).split("=")];
        }
        return pre;
    }, []),
);

for (const key in params) {
    if (whisperParams.hasOwnProperty(key)) {
        whisperParams[key] = params[key];
    }
}

console.log('whisperParams =', whisperParams);
console.log(whisper(whisperParams));