Spaces:
Sleeping
Sleeping
Lucas Zanek
commited on
whisper.addon : fixed test to new async implementation (#686)
Browse files* fixed blocking code on node addon
* modify the example to run async
* format
* added logic to see the whisper output
* added logic to see the whisper output
* removed extra function for more clean example
* fixed whisper test to new async implementation
examples/addon.node/__test__/whisper.spec.js
CHANGED
|
@@ -1,15 +1,22 @@
|
|
| 1 |
-
const path = require(
|
| 2 |
-
const { whisper } = require(path.join(
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 3 |
|
| 4 |
const whisperParamsMock = {
|
| 5 |
-
|
| 6 |
-
|
| 7 |
-
|
| 8 |
};
|
| 9 |
|
| 10 |
describe("Run whisper.node", () => {
|
|
|
|
|
|
|
| 11 |
|
| 12 |
-
|
| 13 |
-
|
| 14 |
-
});
|
| 15 |
});
|
|
|
|
| 1 |
+
const path = require("path");
|
| 2 |
+
const { whisper } = require(path.join(
|
| 3 |
+
__dirname,
|
| 4 |
+
"../../../build/Release/whisper-addon"
|
| 5 |
+
));
|
| 6 |
+
const { promisify } = require("util");
|
| 7 |
+
|
| 8 |
+
const whisperAsync = promisify(whisper);
|
| 9 |
|
| 10 |
const whisperParamsMock = {
|
| 11 |
+
language: "en",
|
| 12 |
+
model: path.join(__dirname, "../../../models/ggml-base.en.bin"),
|
| 13 |
+
fname_inp: path.join(__dirname, "../../../samples/jfk.wav"),
|
| 14 |
};
|
| 15 |
|
| 16 |
describe("Run whisper.node", () => {
|
| 17 |
+
test("it should receive a non-empty value", async () => {
|
| 18 |
+
let result = await whisperAsync(whisperParamsMock);
|
| 19 |
|
| 20 |
+
expect(result.length).toBeGreaterThan(0);
|
| 21 |
+
});
|
|
|
|
| 22 |
});
|