@remotion/install-whisper-cpp 4.0.137 → 4.0.139
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/download-whisper-model.js +32 -22
- package/dist/index.d.ts +2 -2
- package/dist/transcribe.js +1 -1
- package/package.json +4 -4
|
@@ -28,7 +28,6 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
|
28
28
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
29
29
|
exports.downloadWhisperModel = exports.getModelPath = void 0;
|
|
30
30
|
const fs_1 = __importStar(require("fs"));
|
|
31
|
-
const node_stream_1 = require("node:stream");
|
|
32
31
|
const path_1 = __importDefault(require("path"));
|
|
33
32
|
const models = [
|
|
34
33
|
'tiny',
|
|
@@ -74,29 +73,40 @@ const downloadWhisperModel = async ({ model, folder, printOutput = true, onProgr
|
|
|
74
73
|
const totalFileSize = parseInt(contentLength, 10);
|
|
75
74
|
let downloaded = 0;
|
|
76
75
|
let lastPrinted = 0;
|
|
77
|
-
const
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
downloaded === totalFileSize) {
|
|
87
|
-
console.log(`Downloaded ${downloaded} of ${contentLength} bytes (${((downloaded / Number(contentLength)) *
|
|
88
|
-
100).toFixed(2)}%)`);
|
|
89
|
-
lastPrinted = downloaded;
|
|
76
|
+
const reader = body.getReader();
|
|
77
|
+
// eslint-disable-next-line no-async-promise-executor
|
|
78
|
+
await new Promise(async (resolve, reject) => {
|
|
79
|
+
try {
|
|
80
|
+
// eslint-disable-next-line no-constant-condition
|
|
81
|
+
while (true) {
|
|
82
|
+
const { done, value } = await reader.read();
|
|
83
|
+
if (!value) {
|
|
84
|
+
throw new Error('Failed to read from stream');
|
|
90
85
|
}
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
86
|
+
downloaded += value.length;
|
|
87
|
+
if (printOutput) {
|
|
88
|
+
if (downloaded - lastPrinted > 1024 * 1024 * 10 ||
|
|
89
|
+
downloaded === totalFileSize) {
|
|
90
|
+
console.log(`Downloaded ${downloaded} of ${contentLength} bytes (${((downloaded / Number(contentLength)) *
|
|
91
|
+
100).toFixed(2)}%)`);
|
|
92
|
+
lastPrinted = downloaded;
|
|
93
|
+
}
|
|
94
|
+
}
|
|
95
|
+
fileStream.write(value, () => {
|
|
96
|
+
onProgress === null || onProgress === void 0 ? void 0 : onProgress(downloaded, totalFileSize);
|
|
97
|
+
if (downloaded === totalFileSize) {
|
|
98
|
+
fileStream.end();
|
|
99
|
+
resolve();
|
|
100
|
+
}
|
|
101
|
+
});
|
|
102
|
+
if (done) {
|
|
103
|
+
break;
|
|
97
104
|
}
|
|
98
|
-
}
|
|
99
|
-
}
|
|
105
|
+
}
|
|
106
|
+
}
|
|
107
|
+
catch (e) {
|
|
108
|
+
reject(e);
|
|
109
|
+
}
|
|
100
110
|
});
|
|
101
111
|
return { alreadyExisted: false };
|
|
102
112
|
};
|
package/dist/index.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
1
|
export { Caption, convertToCaptions } from './convert-to-captions';
|
|
2
|
-
export {
|
|
2
|
+
export { OnProgress, WhisperModel, downloadWhisperModel, } from './download-whisper-model';
|
|
3
3
|
export { installWhisperCpp } from './install-whisper-cpp';
|
|
4
|
-
export {
|
|
4
|
+
export { TranscriptionJson, transcribe } from './transcribe';
|
package/dist/transcribe.js
CHANGED
|
@@ -57,7 +57,7 @@ const transcribeToTempJSON = async ({ fileToTranscribe, whisperPath, model, tmpJ
|
|
|
57
57
|
'--output-json',
|
|
58
58
|
'--max-len',
|
|
59
59
|
'1',
|
|
60
|
-
'-ojf',
|
|
60
|
+
'-ojf', // Output full JSON
|
|
61
61
|
tokenLevelTimestamps ? ['--dtw', model] : null,
|
|
62
62
|
model ? [`-m`, `${modelPath}`] : null,
|
|
63
63
|
translate ? '-tr' : null,
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@remotion/install-whisper-cpp",
|
|
3
|
-
"version": "4.0.
|
|
3
|
+
"version": "4.0.139",
|
|
4
4
|
"description": "Install helper for Whisper.cpp",
|
|
5
5
|
"main": "dist/index.js",
|
|
6
6
|
"sideEffects": false,
|
|
@@ -21,13 +21,13 @@
|
|
|
21
21
|
"react-dom": ">=16.8.0"
|
|
22
22
|
},
|
|
23
23
|
"devDependencies": {
|
|
24
|
-
"@jonny/eslint-config": "3.0.
|
|
24
|
+
"@jonny/eslint-config": "3.0.281",
|
|
25
25
|
"@types/node": "18.14.6",
|
|
26
|
-
"eslint": "8.
|
|
26
|
+
"eslint": "8.56.0",
|
|
27
27
|
"eslint-plugin-10x": "1.5.2",
|
|
28
28
|
"eslint-plugin-react": "7.32.2",
|
|
29
29
|
"eslint-plugin-react-hooks": "4.4.0",
|
|
30
|
-
"prettier": "3.
|
|
30
|
+
"prettier": "3.2.5",
|
|
31
31
|
"prettier-plugin-organize-imports": "3.2.4",
|
|
32
32
|
"vitest": "0.31.1"
|
|
33
33
|
},
|