whisper node
0.3.1
Openai의 속삭임에 대한 node.js 바인딩. 전사가 현지에 완료되었습니다.
npm install whisper-node
npx whisper-node download
Windows의 요구 사항 : 여기에서 make
명령을 설치하십시오.
import whisper from 'whisper-node' ;
const transcript = await whisper ( "example/sample.wav" ) ;
console . log ( transcript ) ; // output: [ {start,end,speech} ]
[
{
"start" : "00:00:14.310" , // time stamp begin
"end" : "00:00:16.480" , // time stamp end
"speech" : "howdy" // transcription
}
]
import whisper from 'whisper-node' ;
const filePath = "example/sample.wav" ; // required
const options = {
modelName : "base.en" , // default
// modelPath: "/custom/path/to/model.bin", // use model in a custom directory (cannot use along with 'modelName')
whisperOptions : {
language : 'auto' // default (use 'auto' for auto detect)
gen_file_txt : false , // outputs .txt file
gen_file_subtitle : false , // outputs .srt file
gen_file_vtt : false , // outputs .vtt file
word_timestamps : true // timestamp for every word
// timestamp_size: 0 // cannot use along with word_timestamps:true
}
}
const transcript = await whisper ( filePath , options ) ;
파일은 .wav 및 16Hz 여야합니다
예 .mp3 파일 FFMPEG 명령으로 변환 된 파일 : ffmpeg -i input.mp3 -ar 16000 output.wav
d.ts
파일에 TypeScript TypeScript 유형을 포함시킵니다 npm run dev
'/src/test.ts'에서 Nodemon과 TSC를 실행합니다.
npm run build
TSC, 출력을 '/dist'로 실행하고 'dist/download.js'에 대한 허가를 제공합니다.