UNPKG

react-native-executorch

Version:

An easy way to run AI models in react native with ExecuTorch

29 lines (28 loc) 1.28 kB
"use strict"; import { SpeechToTextController } from '../../controllers/SpeechToTextController'; export class SpeechToText { static onDownloadProgressCallback = _downloadProgress => {}; static async load(modelName, transcribeCallback, modelDownloadProgessCallback, encoderSource, decoderSource, tokenizerSource, overlapSeconds, windowSize, streamingConfig) { this.module = new SpeechToTextController({ transcribeCallback: transcribeCallback, modelDownloadProgessCallback: modelDownloadProgessCallback, overlapSeconds: overlapSeconds, windowSize: windowSize, streamingConfig: streamingConfig }); await this.module.loadModel(modelName = modelName, encoderSource = encoderSource, decoderSource = decoderSource, tokenizerSource = tokenizerSource); } static configureStreaming(overlapSeconds, windowSize, streamingConfig) { this.module?.configureStreaming(overlapSeconds, windowSize, streamingConfig); } static async transcribe(waveform) { return await this.module.transcribe(waveform); } static async encode(waveform) { return await this.module.encode(waveform); } static async decode(seq, encodings) { return await this.module.decode(seq, encodings); } } //# sourceMappingURL=SpeechToTextModule.js.map