🎥 Make videos programmatically with React
add docs basic
Hunain Ahmedf1a59156e94f
diff --git a/packages/docs/docs/whisper-wasm/download-model.mdx b/packages/docs/docs/whisper-wasm/download-model.mdxnew file mode 100644index 0000000000..bf73eb602e--- /dev/null+++ b/packages/docs/docs/whisper-wasm/download-model.mdx@@ -0,0 +1,53 @@+---+title: downloadModel()+crumb: '@remotion/whisper-wasm'+---++# downloadModel()++Downloads a Whisper.cpp model to the browser.++```tsx title="app.tsx"+import { useEffect, useState } from "react";+import {downloadModel} from '@remotion/whisper-wasm';++export default function MyApp(){+ const [progress, setProgress] = useState(0)+ useEffect(()=>{+ downloadModel('tiny.en', setProgress);+ },[]);++ return (+ <h1>my great app</h1>+ )+}+```++## Arguments+++### `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`.++### `onProgress?`++Act 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.++## See also++- [Source code for this function](https://github.com/remotion-dev/remotion/blob/main/packages/whisper-wasm/src/helpers.ts)+- [`@remotion/whisper-wasm`](/docs/whisper-wasm)+- [`transcribe()`](/docs/whisper-wasm/transcribe)diff --git a/packages/docs/docs/whisper-wasm/index.mdx b/packages/docs/docs/whisper-wasm/index.mdxnew file mode 100644index 0000000000..d40ab4963e--- /dev/null+++ b/packages/docs/docs/whisper-wasm/index.mdx@@ -0,0 +1,61 @@+---++title: '@remotion/whisper-wasm'+crumb: 'Transcribe audio in browser'+---++<!-- _Available from v4.0.115_ -->++Similar to [@remotion/install-whisper-cpp](/docs/install-whisper-cpp) but for the browser. Allows you to transcribe audio locally in the browser, with the help of WASM.++import {TableOfContents} from './whisper-wasm';++<Installation pkg="@remotion/whisper-wasm" />++## Example usage+++```tsx title="app.tsx"++import { downloadModel, 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("");++ useEffect(()=>{+ downloadModel('tiny.en', downloadProgress);+ },[]);++ const onTranscribeChunk = (start:string, end:string, text:string) => {+ // do something+ }++ return (+ <div>++ <input type="file" accept=".wav" onChange={(e)=>{+ transcribe(e.target.files[0], transcriptionProgress, onTranscribeChunk, 12)+ .then(result => setText(result));+++ }} />++ <progress value={transcriptionProgress} max={100} />+ </div>+ );+}++```++## Functions++<TableOfContents />++## License++MITdiff --git a/packages/docs/docs/whisper-wasm/transcribe.mdx b/packages/docs/docs/whisper-wasm/transcribe.mdxnew file mode 100644index 0000000000..32dbf50466--- /dev/null+++ b/packages/docs/docs/whisper-wasm/transcribe.mdx@@ -0,0 +1,65 @@+---+title: transcribe()+crumb: '@remotion/whisper-wasm'+---++# transcribe()++Transcribes a media file by utilizing Whisper.cpp.++```tsx 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(e.target.files[0])+ .then(result => setText(result));+ }} />+ )+}+```++## Arguments++### `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+};+```++### `onTranscribeChunk?`++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} `)+ }+```++### `threads?`+The number of threads to use for transcription, set to `8` by default.+++## See also++- [Source code for this function](https://github.com/remotion-dev/remotion/blob/main/packages/whisper-wasm/src/helpers.ts)+- [`@remotion/whisper-wasm`](/docs/whisper-wasm)+- [`downloadModel()`](/docs/whisper-wasm/download-model)diff --git a/packages/docs/docs/whisper-wasm/whisper-wasm.tsx b/packages/docs/docs/whisper-wasm/whisper-wasm.tsxnew file mode 100644index 0000000000..42986aa3e8--- /dev/null+++ b/packages/docs/docs/whisper-wasm/whisper-wasm.tsx@@ -0,0 +1,20 @@+import React from 'react';+import {Grid} from '../../components/TableOfContents/Grid';+import {TOCItem} from '../../components/TableOfContents/TOCItem';++export const TableOfContents: React.FC = () => {+ return (+ <div>+ <Grid>+ <TOCItem link="/docs/whisper-wasm/download-model">+ <strong>downloadModel()</strong>+ <div>Download a Whisper model in browser</div>+ </TOCItem>+ <TOCItem link="/docs/whisper-wasm/transcribe">+ <strong>transcribe()</strong>+ <div>Transcribe an audio file in the WASM environemnt</div>+ </TOCItem>+ </Grid>+ </div>+ );+};