Skip to content

🎥 Make videos programmatically with React

Docs: Use automatic loading in WebGPU examples

Jonny Burger0987a6e65e1a
diff --git a/packages/docs/docs/video-matting/index.mdx b/packages/docs/docs/video-matting/index.mdx
index 09d0a4830f..cf494e9379 100644
--- a/packages/docs/docs/video-matting/index.mdx
+++ b/packages/docs/docs/video-matting/index.mdx
@@ -17,11 +17,7 @@ import {TableOfContents} from './table-of-contents';
## Example
```ts twoslash title="separate-video.ts"
-import {
- downloadVideoMattingModel,
- loadVideoMattingModel,
- separateVideoLayers,
-} from '@remotion/video-matting';
+import {downloadVideoMattingModel, separateVideoLayers} from '@remotion/video-matting';
export const matteVideo = async (file: File) => {
const model = 'modnet';
@@ -29,10 +25,6 @@ export const matteVideo = async (file: File) => {
model,
onProgress: ({progress}) => console.log('Downloading model:', progress),
});
- await using modelHandle = await loadVideoMattingModel({
- model,
- });
-
await using layers = await separateVideoLayers({
src: file,
model,
@@ -48,7 +40,9 @@ export const matteVideo = async (file: File) => {
};
```
-[`separateVideoLayers()`](/docs/video-matting/separate-video-layers) loads the model automatically; use [`loadVideoMattingModel()`](/docs/video-matting/load-video-matting-model) with `await using` when you want to initialize it before processing and release it when the scope ends. Call [`disposeVideoMattingModel()`](/docs/video-matting/dispose-video-matting-model) when you want to release a model loaded automatically. `await using` also removes the temporary output files when `matteVideo()` returns; the blobs remain usable.
+[`separateVideoLayers()`](/docs/video-matting/separate-video-layers) loads the downloaded model automatically. Use [`loadVideoMattingModel()`](/docs/video-matting/load-video-matting-model) with `await using` when you want to initialize it before processing and release it when the scope ends. Call [`disposeVideoMattingModel()`](/docs/video-matting/dispose-video-matting-model) when you want to release a model loaded automatically.
+
+`await using layers` removes the temporary output files when `matteVideo()` returns; the blobs remain usable.
## Model hosting
diff --git a/packages/docs/docs/whisper-webgpu/index.mdx b/packages/docs/docs/whisper-webgpu/index.mdx
index 6e35a6db7d..67735bfa62 100644
--- a/packages/docs/docs/whisper-webgpu/index.mdx
+++ b/packages/docs/docs/whisper-webgpu/index.mdx
@@ -17,12 +17,11 @@ import {TableOfContents} from './table-of-contents';
## Example
```ts twoslash title="transcribe.ts"
-import {clearStaleModels, downloadWhisperModel, loadWhisperModel, resampleTo16Khz, toCaptions, transcribe} from '@remotion/whisper-webgpu';
+import {clearStaleModels, downloadWhisperModel, resampleTo16Khz, toCaptions, transcribe} from '@remotion/whisper-webgpu';
export const transcribeFile = async (file: File) => {
await clearStaleModels();
await downloadWhisperModel({model: 'small.en'});
- await using modelHandle = await loadWhisperModel({model: 'small.en'});
const channelWaveform = await resampleTo16Khz({file});
const transcription = await transcribe({
@@ -36,7 +35,7 @@ export const transcribeFile = async (file: File) => {
};
```
-[`downloadWhisperModel()`](/docs/whisper-webgpu/download-whisper-model) stores model files in the persistent cache. [`transcribe()`](/docs/whisper-webgpu/transcribe) loads the model automatically; use [`loadWhisperModel()`](/docs/whisper-webgpu/load-whisper-model) with `await using` when you want to initialize it before transcription and release it when the scope ends. Call [`disposeWhisperModel()`](/docs/whisper-webgpu/dispose-whisper-model) when you want to release a model loaded automatically.
+[`downloadWhisperModel()`](/docs/whisper-webgpu/download-whisper-model) stores model files in the persistent cache. [`transcribe()`](/docs/whisper-webgpu/transcribe) loads the model automatically. Use [`loadWhisperModel()`](/docs/whisper-webgpu/load-whisper-model) with `await using` when you want to initialize it before transcription and release it when the scope ends. Call [`disposeWhisperModel()`](/docs/whisper-webgpu/dispose-whisper-model) when you want to release a model loaded automatically.
## Model hosting