File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change 11{
22 "name" : " nodejs-whisper" ,
3- "version" : " 0.0.8 " ,
3+ "version" : " 0.0.10 " ,
44 "description" : " Node bindings for OpenAI's Whisper. Optimized for CPU." ,
55 "main" : " dist/index.js" ,
66 "types" : " dist/index.d.ts" ,
Original file line number Diff line number Diff line change @@ -36,6 +36,24 @@ export default async function downloadModel() {
3636 try {
3737 shell . cd ( path . join ( __dirname , '..' , './cpp/whisper.cpp/models' ) )
3838
39+ const args = process . argv . slice ( 2 )
40+ if ( args . length > 0 ) {
41+ const modelName = args [ 0 ]
42+ console . log ( 'Downloading model:' , modelName )
43+ if ( ! MODELS_LIST . includes ( modelName ) ) {
44+ throw `[Nodejs-whisper] Error: Model name not found. Check your spelling.`
45+ }
46+ let scriptPath = './download-ggml-model.sh'
47+
48+ if ( process . platform === 'win32' ) scriptPath = 'download-ggml-model.cmd'
49+ shell . chmod ( '+x' , scriptPath )
50+ shell . exec ( `${ scriptPath } ${ modelName } ` )
51+ console . log ( '[Nodejs-whisper] Attempting to compile model...\n' )
52+ shell . cd ( '../' )
53+ shell . exec ( 'make' )
54+ process . exit ( 0 )
55+ }
56+
3957 let anyModelExist = [ ]
4058
4159 MODELS . forEach ( model => {
You can’t perform that action at this time.
0 commit comments