🎥 Make videos programmatically with React
finish
Jonny Burgerc36d5f6ac724
diff --git a/packages/docs/docs/install-whisper-cpp/download-whisper-model.mdx b/packages/docs/docs/install-whisper-cpp/download-whisper-model.mdxindex 29435f532d..9e17fa56a3 100644--- a/packages/docs/docs/install-whisper-cpp/download-whisper-model.mdx+++ b/packages/docs/docs/install-whisper-cpp/download-whisper-model.mdx@@ -25,7 +25,7 @@ const { alreadyExisted } = await downloadWhisperModel({### `folder`-The folder to download the model to. The model will be downloaded into this folder with the filename `ggml-${model}.bin`+The folder to download the model to. The model will be downloaded into this folder with the filename `ggml-${model}.bin`.### `model`diff --git a/packages/install-whisper-cpp/src/install-whisper-cpp.ts b/packages/install-whisper-cpp/src/install-whisper-cpp.tsindex d9c6717c31..e507e08fe8 100644--- a/packages/install-whisper-cpp/src/install-whisper-cpp.ts+++ b/packages/install-whisper-cpp/src/install-whisper-cpp.ts@@ -1,93 +1,93 @@-import fs, { existsSync, rmSync } from "fs";-import { execSync } from "node:child_process";-import { Readable } from "node:stream";-import type { ReadableStream } from "node:stream/web";-import { finished } from "node:stream/promises";-import path from "path";-import type { StdioOptions } from "child_process";+import type {StdioOptions} from 'child_process';+import fs, {existsSync, rmSync} from 'fs';+import {execSync} from 'node:child_process';+import {Readable} from 'node:stream';+import {finished} from 'node:stream/promises';+import type {ReadableStream} from 'node:stream/web';+import path from 'path';const installForWindows = async ({- version,- to,- printOutput,+ version,+ to,+ printOutput,}: {- version: string;- to: string;- printOutput: boolean;+ version: string;+ to: string;+ printOutput: boolean;}) => {- const url = `https://github.com/ggerganov/whisper.cpp/releases/download/v${version}/whisper-bin-x64.zip`;+ const url = `https://github.com/ggerganov/whisper.cpp/releases/download/v${version}/whisper-bin-x64.zip`;- const filePath = path.join(process.cwd(), "whisper-bin-x64.zip");- const fileStream = fs.createWriteStream(filePath);+ const filePath = path.join(process.cwd(), 'whisper-bin-x64.zip');+ const fileStream = fs.createWriteStream(filePath);- const { body } = await fetch(url);- if (body === null) {- throw new Error("Failed to download whisper binary");- }+ const {body} = await fetch(url);+ if (body === null) {+ throw new Error('Failed to download whisper binary');+ }- await finished(Readable.fromWeb(body as ReadableStream).pipe(fileStream));+ await finished(Readable.fromWeb(body as ReadableStream).pipe(fileStream));- execSync(`Expand-Archive -Force ${filePath} ${to}`, {- shell: "powershell",- stdio: printOutput ? "inherit" : "ignore",- });+ execSync(`Expand-Archive -Force ${filePath} ${to}`, {+ shell: 'powershell',+ stdio: printOutput ? 'inherit' : 'ignore',+ });- rmSync(filePath);+ rmSync(filePath);};const installWhisperForUnix = ({- version,- to,- printOutput,+ version,+ to,+ printOutput,}: {- version: string;- to: string;- printOutput: boolean;+ version: string;+ to: string;+ printOutput: boolean;}) => {- const stdio: StdioOptions = printOutput ? "inherit" : "ignore";- execSync(`git clone https://github.com/ggerganov/whisper.cpp.git ${to}`, {- stdio,- });+ const stdio: StdioOptions = printOutput ? 'inherit' : 'ignore';+ execSync(`git clone https://github.com/ggerganov/whisper.cpp.git ${to}`, {+ stdio,+ });- execSync(`git checkout v${version}`, {- stdio,- cwd: to,- });+ execSync(`git checkout v${version}`, {+ stdio,+ cwd: to,+ });- execSync(`make`, {- cwd: to,- stdio,- });+ execSync(`make`, {+ cwd: to,+ stdio,+ });};export const installWhisperCpp = async ({- version,- to,- printOutput = true,+ version,+ to,+ printOutput = true,}: {- version: string;- to: string;- printOutput?: boolean;+ version: string;+ to: string;+ printOutput?: boolean;}): Promise<{- alreadyExisted: boolean;+ alreadyExisted: boolean;}> => {- if (existsSync(to)) {- if (printOutput) {- console.log(`Whisper already exists at ${to}`);- }+ if (existsSync(to)) {+ if (printOutput) {+ console.log(`Whisper already exists at ${to}`);+ }- return Promise.resolve({ alreadyExisted: true });- }+ return Promise.resolve({alreadyExisted: true});+ }- if (process.platform === "darwin" || process.platform === "linux") {- installWhisperForUnix({ version, to, printOutput });- return Promise.resolve({ alreadyExisted: false });- }+ if (process.platform === 'darwin' || process.platform === 'linux') {+ installWhisperForUnix({version, to, printOutput});+ return Promise.resolve({alreadyExisted: false});+ }- if (process.platform === "win32") {- await installForWindows({ version, to, printOutput });- return Promise.resolve({ alreadyExisted: false });- }+ if (process.platform === 'win32') {+ await installForWindows({version, to, printOutput});+ return Promise.resolve({alreadyExisted: false});+ }- throw new Error(`Unsupported platform: ${process.platform}`);+ throw new Error(`Unsupported platform: ${process.platform}`);};