🎥 Make videos programmatically with React
update docs
Hunain Ahmed8ff4b7536f3d
diff --git a/packages/docs/docs/whisper-wasm/download-whisper-model.mdx b/packages/docs/docs/whisper-wasm/download-whisper-model.mdxindex 0269b0972f..59947949ff 100644--- a/packages/docs/docs/whisper-wasm/download-whisper-model.mdx+++ b/packages/docs/docs/whisper-wasm/download-whisper-model.mdx@@ -5,27 +5,24 @@ crumb: '@remotion/whisper-wasm'# downloadWhisperModel()-Downloads a Whisper.cpp model to the browser.+Downloads a Whisper.cpp model to the browser.-```tsx title="app.tsx"-import { useEffect, useState } from "react";+```tsx twoslash title="app.tsx"+import {useEffect, useState} from 'react';import {downloadWhisperModel} from '@remotion/whisper-wasm';-export default function MyApp(){- const [progress, setProgress] = useState(0)- useEffect(()=>{+export default function MyApp() {+ const [progress, setProgress] = useState(0);+ useEffect(() => {downloadWhisperModel({model: 'tiny.en', onProgress: setProgress});- },[]);+ }, []);- return (- <h1>my great app</h1>- )+ return <h1>my great app</h1>;}```## Options-### `model`The model to download. Possible values: `tiny`, `tiny.en`, `base`, `base.en`, `small`, `small.en`, `medium`, `medium.en`, `large-v1`, `large-v2`, `large-v3`, `large-v3-turbo`.@@ -35,16 +32,14 @@ The model to download. Possible values: `tiny`, `tiny.en`, `base`, `base.en`, `sAct upon download progress. This is the function signature:```tsx twoslash-const onProgress = (progress: number) => {// do something};```-## Return Value-resolves with the message `Model loaded successfully` if the model has been successfully stored in the `indexedDB` storage of the browser.+resolves with the message `Model loaded successfully` if the model has been successfully stored in the `indexedDB` storage of the browser.## See alsodiff --git a/packages/docs/docs/whisper-wasm/index.mdx b/packages/docs/docs/whisper-wasm/index.mdxindex b745f1eaac..4a9e8bb669 100644--- a/packages/docs/docs/whisper-wasm/index.mdx+++ b/packages/docs/docs/whisper-wasm/index.mdx@@ -1,5 +1,4 @@----title: '@remotion/whisper-wasm'crumb: 'Transcribe audio in browser'---@@ -14,42 +13,41 @@ import {TableOfContents} from './whisper-wasm';## Example usage--```tsx title="app.tsx"--import { downloadWhisperModel, transcribe } from "@remotion/whisper-wasm"-import { useEffect, useState } from "react";--+```tsx twoslash title="app.tsx"+import {downloadWhisperModel, transcribe} from '@remotion/whisper-wasm';+import {useEffect, useState} from 'react';export default function Home() {const [downloadProgress, setDownloadProgress] = useState(0);const [transcriptionProgress, setTranscriptionProgress] = useState(0);- const [text, setText] = useState("");+ const [text, setText] = useState('');- useEffect(()=>{- downloadWhisperModel({model:'tiny.en', onProgress: downloadProgress});- },[]);+ useEffect(() => {+ downloadWhisperModel({model: 'tiny.en', onProgress: setDownloadProgress});+ }, []);- const onTranscribeChunk = (start:string, end:string, text:string) => {+ const onTranscribeChunk = (start: string, end: string, text: string) => {// do something- }+ };return (- <div>-- <input type="file" accept=".wav" onChange={(e)=>{- transcribe({file: e.target.files[0], onProgress: transcriptionProgress, onTranscribeChunk, threads: 12})- .then(result => setText(result));--- }} />-+ <div>+ <input+ type="file"+ accept=".wav"+ onChange={(e) =>+ e.target.files &&+ transcribe({+ file: e.target.files[0],+ onProgress: setTranscriptionProgress,+ }).then((result) => console.log(result))+ }+ />+<progress value={transcriptionProgress} max={100} />- </div>+ </div>);}-```## Functionsdiff --git a/packages/docs/docs/whisper-wasm/transcribe.mdx b/packages/docs/docs/whisper-wasm/transcribe.mdxindex b0df6f7542..4e0f19701c 100644--- a/packages/docs/docs/whisper-wasm/transcribe.mdx+++ b/packages/docs/docs/whisper-wasm/transcribe.mdx@@ -5,22 +5,27 @@ crumb: '@remotion/whisper-wasm'# transcribe()-Transcribes a media file by utilizing Whisper.cpp.+Transcribes a media file by utilizing Whisper.cpp.-```tsx title="app.tsx"-import { useState } from "react";+```tsx twoslash title="app.tsx"+import {useState} from 'react';import {transcribe} from '@remotion/whisper-wasm';-export default function MyApp(){- const [text, setText] = useState("");--- return(- <input type="file" accept=".wav" onChange={(e)=>{- transcribe({file: e.target.files[0]})- .then(result => setText(result));- }} />- )+export default function MyApp() {+ const [text, setText] = useState('');++ return (+ <input+ type="file"+ accept=".wav"+ onChange={(e) =>+ e.target.files &&+ transcribe({+ file: e.target.files[0]+ }).then((result) => console.log(result))+ }+ />+ );}```@@ -28,16 +33,13 @@ export default function MyApp(){### `file`-The audio file you want extract text from. The file has to be a 16KHz wav file.--+The audio file you want extract text from. The file has to be a 16KHz wav file.### `onProgress?`Act upon transcription progress. This is the function signature:```tsx twoslash-const onProgress = (progress: number) => {// do something};@@ -48,15 +50,14 @@ const onProgress = (progress: number) => {Called when a new chunk of text has been extracted from the file. This is the function signature:```tsx twoslash-- const onTranscribeChunk = (start:string, end:string, text:string) => {- console.log(`transcribed ${text} for the time ${start} to ${end} `)- }+const onTranscribeChunk = (start: string, end: string, text: string) => {+ console.log(`transcribed ${text} for the time ${start} to ${end} `);+};```### `threads?`-The number of threads to use for transcription, set to `8` by default.+The number of threads to use for transcription, set to `8` by default.## See also