mirror of
https://github.com/ggerganov/whisper.cpp.git
synced 2024-12-24 06:46:37 +00:00
node : support no timestamps (#2048)
* fix: node: do not compute timestamps if you do not need them * feat: add no_timestamps parameter to node addon
This commit is contained in:
parent
c7f95b7ca2
commit
1b5439a6c2
@ -211,6 +211,8 @@ int run(whisper_params ¶ms, std::vector<std::vector<std::string>> &result) {
|
|||||||
|
|
||||||
wparams.initial_prompt = params.prompt.c_str();
|
wparams.initial_prompt = params.prompt.c_str();
|
||||||
|
|
||||||
|
wparams.no_timestamps = params.no_timestamps;
|
||||||
|
|
||||||
whisper_print_user_data user_data = { ¶ms, &pcmf32s };
|
whisper_print_user_data user_data = { ¶ms, &pcmf32s };
|
||||||
|
|
||||||
// this callback is called on each new segment
|
// this callback is called on each new segment
|
||||||
@ -298,11 +300,13 @@ Napi::Value whisper(const Napi::CallbackInfo& info) {
|
|||||||
std::string model = whisper_params.Get("model").As<Napi::String>();
|
std::string model = whisper_params.Get("model").As<Napi::String>();
|
||||||
std::string input = whisper_params.Get("fname_inp").As<Napi::String>();
|
std::string input = whisper_params.Get("fname_inp").As<Napi::String>();
|
||||||
bool use_gpu = whisper_params.Get("use_gpu").As<Napi::Boolean>();
|
bool use_gpu = whisper_params.Get("use_gpu").As<Napi::Boolean>();
|
||||||
|
bool no_timestamps = whisper_params.Get("no_timestamps").As<Napi::Boolean>();
|
||||||
|
|
||||||
params.language = language;
|
params.language = language;
|
||||||
params.model = model;
|
params.model = model;
|
||||||
params.fname_inp.emplace_back(input);
|
params.fname_inp.emplace_back(input);
|
||||||
params.use_gpu = use_gpu;
|
params.use_gpu = use_gpu;
|
||||||
|
params.no_timestamps = no_timestamps;
|
||||||
|
|
||||||
Napi::Function callback = info[1].As<Napi::Function>();
|
Napi::Function callback = info[1].As<Napi::Function>();
|
||||||
Worker* worker = new Worker(callback, params);
|
Worker* worker = new Worker(callback, params);
|
||||||
|
Loading…
Reference in New Issue
Block a user