Spaces:
Running
Running
node : support no timestamps (#2048)
Browse files* fix: node: do not compute timestamps if you do not need them
* feat: add no_timestamps parameter to node addon
examples/addon.node/addon.cpp
CHANGED
|
@@ -211,6 +211,8 @@ int run(whisper_params ¶ms, std::vector<std::vector<std::string>> &result) {
|
|
| 211 |
|
| 212 |
wparams.initial_prompt = params.prompt.c_str();
|
| 213 |
|
|
|
|
|
|
|
| 214 |
whisper_print_user_data user_data = { ¶ms, &pcmf32s };
|
| 215 |
|
| 216 |
// this callback is called on each new segment
|
|
@@ -298,11 +300,13 @@ Napi::Value whisper(const Napi::CallbackInfo& info) {
|
|
| 298 |
std::string model = whisper_params.Get("model").As<Napi::String>();
|
| 299 |
std::string input = whisper_params.Get("fname_inp").As<Napi::String>();
|
| 300 |
bool use_gpu = whisper_params.Get("use_gpu").As<Napi::Boolean>();
|
|
|
|
| 301 |
|
| 302 |
params.language = language;
|
| 303 |
params.model = model;
|
| 304 |
params.fname_inp.emplace_back(input);
|
| 305 |
params.use_gpu = use_gpu;
|
|
|
|
| 306 |
|
| 307 |
Napi::Function callback = info[1].As<Napi::Function>();
|
| 308 |
Worker* worker = new Worker(callback, params);
|
|
|
|
| 211 |
|
| 212 |
wparams.initial_prompt = params.prompt.c_str();
|
| 213 |
|
| 214 |
+
wparams.no_timestamps = params.no_timestamps;
|
| 215 |
+
|
| 216 |
whisper_print_user_data user_data = { ¶ms, &pcmf32s };
|
| 217 |
|
| 218 |
// this callback is called on each new segment
|
|
|
|
| 300 |
std::string model = whisper_params.Get("model").As<Napi::String>();
|
| 301 |
std::string input = whisper_params.Get("fname_inp").As<Napi::String>();
|
| 302 |
bool use_gpu = whisper_params.Get("use_gpu").As<Napi::Boolean>();
|
| 303 |
+
bool no_timestamps = whisper_params.Get("no_timestamps").As<Napi::Boolean>();
|
| 304 |
|
| 305 |
params.language = language;
|
| 306 |
params.model = model;
|
| 307 |
params.fname_inp.emplace_back(input);
|
| 308 |
params.use_gpu = use_gpu;
|
| 309 |
+
params.no_timestamps = no_timestamps;
|
| 310 |
|
| 311 |
Napi::Function callback = info[1].As<Napi::Function>();
|
| 312 |
Worker* worker = new Worker(callback, params);
|