Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions src/autoDownloadModel.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,8 @@ import shell from 'shelljs'
import fs from 'fs'
import { MODEL_OBJECT, MODELS_LIST, WHISPER_CPP_PATH } from './constants'

shell.config.execPath = shell.which('node').stdout

export default async function autoDownloadModel(
logger = console,
autoDownloadModelName?: string,
Expand Down
2 changes: 1 addition & 1 deletion src/constants.ts
Original file line number Diff line number Diff line change
Expand Up @@ -47,4 +47,4 @@ export const DEFAULT_MODEL = 'tiny.en'
export const WHISPER_CPP_PATH = path.join(__dirname, '..', 'cpp', 'whisper.cpp')

export const WHISPER_CPP_MAIN_PATH =
process.platform === 'win32' ? 'build\\bin\\Release\\whisper-cli.exe' : './build/bin/whisper-cli'
process.platform === 'win32' ? 'build\\bin\\whisper-cli.exe' : './build/bin/whisper-cli'
2 changes: 2 additions & 0 deletions src/downloadModel.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,8 @@ import readlineSync from 'readline-sync'
import { MODELS_LIST, DEFAULT_MODEL, MODELS, WHISPER_CPP_PATH, MODEL_OBJECT } from './constants'
import fs from 'fs'

shell.config.execPath = shell.which('node').stdout

const askForModel = async (logger = console): Promise<string> => {
const answer = await readlineSync.question(
`\n[Nodejs-whisper] Enter model name (e.g. 'tiny.en') or 'cancel' to exit\n(ENTER for tiny.en): `
Expand Down
2 changes: 2 additions & 0 deletions src/utils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,8 @@ import fs from 'fs'
import path from 'path'
import shell from 'shelljs'

shell.config.execPath = shell.which('node').stdout

export const checkIfFileExists = (filePath: string) => {
if (!fs.existsSync(filePath)) {
throw new Error(`[Nodejs-whisper] Error: No such file: ${filePath}`)
Expand Down
2 changes: 2 additions & 0 deletions src/whisper.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
import shell from 'shelljs'
import { WHISPER_CPP_PATH, WHISPER_CPP_MAIN_PATH } from './constants'

shell.config.execPath = shell.which('node').stdout

const projectDir = process.cwd()

export interface IShellOptions {
Expand Down