Skip to main content

downloadWhisperModel()

warning

不稳定的 API:此软件包目前处于实验阶段。在测试过程中,我们可能会对 API 做一些更改,并在未来切换到基于 WebGPU 的后端。

将 Whisper 模型下载到 IndexedDB。

🌐 Downloads a Whisper model into IndexedDB.

app.ts
import {downloadWhisperModel} from '@remotion/whisper-web'; const {alreadyDownloaded} = await downloadWhisperModel({ model: 'tiny.en', onProgress: (progress) => { console.log(progress); }, });

选项

🌐 Options

model

要下载的模型。可能的取值:tinytiny.enbasebase.ensmallsmall.en

🌐 The model to download. Possible values: tiny, tiny.en, base, base.en, small, small.en.

onProgress?

根据下载进度采取行动。以下是函数签名:

🌐 Act upon download progress. This is the function signature:

import {DownloadWhisperModelOnProgress, DownloadWhisperModelProgress} from '@remotion/whisper-web';

const onProgress: DownloadWhisperModelOnProgress = ({progress, totalBytes, downloadedBytes}: DownloadWhisperModelProgress) => {
  console.log({progress, totalBytes, downloadedBytes});
};

返回值

🌐 Return Value

返回一个具有以下属性的对象:

🌐 Returns an object with the following properties:

  • alreadyDownloaded:模型是否已经被下载。

另请参阅

🌐 See also