Spaces:
Running
Running
examples : fix node compilation (#2115)
Browse files* node : fix compilation and update examples
* node : fix readme
* Update addon.node test
.github/workflows/examples.yml
CHANGED
|
@@ -37,7 +37,7 @@ jobs:
|
|
| 37 |
run: npm install
|
| 38 |
|
| 39 |
- name: Compile addon.node
|
| 40 |
-
run: npx cmake-js compile -T
|
| 41 |
|
| 42 |
- name: Download test model
|
| 43 |
run: |
|
|
|
|
| 37 |
run: npm install
|
| 38 |
|
| 39 |
- name: Compile addon.node
|
| 40 |
+
run: npx cmake-js compile -T addon.node -B Release
|
| 41 |
|
| 42 |
- name: Download test model
|
| 43 |
run: |
|
examples/addon.node/CMakeLists.txt
CHANGED
|
@@ -1,4 +1,4 @@
|
|
| 1 |
-
set(TARGET
|
| 2 |
|
| 3 |
# Base settings
|
| 4 |
#==================================================================
|
|
|
|
| 1 |
+
set(TARGET addon.node)
|
| 2 |
|
| 3 |
# Base settings
|
| 4 |
#==================================================================
|
examples/addon.node/README.md
CHANGED
|
@@ -14,14 +14,14 @@ npm install
|
|
| 14 |
Make sure it is in the project root directory and compiled with make-js.
|
| 15 |
|
| 16 |
```shell
|
| 17 |
-
npx cmake-js compile -T
|
| 18 |
```
|
| 19 |
|
| 20 |
For Electron addon and cmake-js options, you can see [cmake-js](https://github.com/cmake-js/cmake-js) and make very few configuration changes.
|
| 21 |
|
| 22 |
> Such as appointing special cmake path:
|
| 23 |
> ```shell
|
| 24 |
-
> npx cmake-js compile -c 'xxx/cmake' -T
|
| 25 |
> ```
|
| 26 |
|
| 27 |
## Run
|
|
|
|
| 14 |
Make sure it is in the project root directory and compiled with make-js.
|
| 15 |
|
| 16 |
```shell
|
| 17 |
+
npx cmake-js compile -T addon.node -B Release
|
| 18 |
```
|
| 19 |
|
| 20 |
For Electron addon and cmake-js options, you can see [cmake-js](https://github.com/cmake-js/cmake-js) and make very few configuration changes.
|
| 21 |
|
| 22 |
> Such as appointing special cmake path:
|
| 23 |
> ```shell
|
| 24 |
+
> npx cmake-js compile -c 'xxx/cmake' -T addon.node -B Release
|
| 25 |
> ```
|
| 26 |
|
| 27 |
## Run
|
examples/addon.node/__test__/whisper.spec.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
| 1 |
const path = require("path");
|
| 2 |
const { whisper } = require(path.join(
|
| 3 |
__dirname,
|
| 4 |
-
"../../../build/Release/
|
| 5 |
));
|
| 6 |
const { promisify } = require("util");
|
| 7 |
|
|
@@ -12,6 +12,7 @@ const whisperParamsMock = {
|
|
| 12 |
model: path.join(__dirname, "../../../models/ggml-base.en.bin"),
|
| 13 |
fname_inp: path.join(__dirname, "../../../samples/jfk.wav"),
|
| 14 |
use_gpu: true,
|
|
|
|
| 15 |
};
|
| 16 |
|
| 17 |
describe("Run whisper.node", () => {
|
|
|
|
| 1 |
const path = require("path");
|
| 2 |
const { whisper } = require(path.join(
|
| 3 |
__dirname,
|
| 4 |
+
"../../../build/Release/addon.node"
|
| 5 |
));
|
| 6 |
const { promisify } = require("util");
|
| 7 |
|
|
|
|
| 12 |
model: path.join(__dirname, "../../../models/ggml-base.en.bin"),
|
| 13 |
fname_inp: path.join(__dirname, "../../../samples/jfk.wav"),
|
| 14 |
use_gpu: true,
|
| 15 |
+
no_timestamps: false,
|
| 16 |
};
|
| 17 |
|
| 18 |
describe("Run whisper.node", () => {
|
examples/addon.node/index.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
| 1 |
const path = require("path");
|
| 2 |
const { whisper } = require(path.join(
|
| 3 |
__dirname,
|
| 4 |
-
"../../build/Release/
|
| 5 |
));
|
| 6 |
const { promisify } = require("util");
|
| 7 |
|
|
@@ -12,6 +12,7 @@ const whisperParams = {
|
|
| 12 |
model: path.join(__dirname, "../../models/ggml-base.en.bin"),
|
| 13 |
fname_inp: "../../samples/jfk.wav",
|
| 14 |
use_gpu: true,
|
|
|
|
| 15 |
};
|
| 16 |
|
| 17 |
const arguments = process.argv.slice(2);
|
|
|
|
| 1 |
const path = require("path");
|
| 2 |
const { whisper } = require(path.join(
|
| 3 |
__dirname,
|
| 4 |
+
"../../build/Release/addon.node"
|
| 5 |
));
|
| 6 |
const { promisify } = require("util");
|
| 7 |
|
|
|
|
| 12 |
model: path.join(__dirname, "../../models/ggml-base.en.bin"),
|
| 13 |
fname_inp: "../../samples/jfk.wav",
|
| 14 |
use_gpu: true,
|
| 15 |
+
no_timestamps: false,
|
| 16 |
};
|
| 17 |
|
| 18 |
const arguments = process.argv.slice(2);
|
examples/addon.node/package.json
CHANGED
|
@@ -1,5 +1,5 @@
|
|
| 1 |
{
|
| 2 |
-
"name": "
|
| 3 |
"version": "0.0.0",
|
| 4 |
"description": "",
|
| 5 |
"main": "index.js",
|
|
|
|
| 1 |
{
|
| 2 |
+
"name": "addon.node",
|
| 3 |
"version": "0.0.0",
|
| 4 |
"description": "",
|
| 5 |
"main": "index.js",
|