react-native-executorch
Version:
An easy way to run AI models in React Native with ExecuTorch
25 lines (24 loc) • 1.7 kB
TypeScript
import { ResourceSource } from '../../types/common';
import { SpeechToTextController } from '../../controllers/SpeechToTextController';
import { AvailableModels, SpeechToTextLanguage } from '../../types/stt';
import { STREAMING_ACTION } from '../../constants/sttDefaults';
export declare class SpeechToTextModule {
private module;
constructor({ transcribeCallback, overlapSeconds, windowSize, streamingConfig, }?: {
transcribeCallback?: (sequence: string) => void;
overlapSeconds?: ConstructorParameters<typeof SpeechToTextController>['0']['overlapSeconds'];
windowSize?: ConstructorParameters<typeof SpeechToTextController>['0']['windowSize'];
streamingConfig?: ConstructorParameters<typeof SpeechToTextController>['0']['streamingConfig'];
});
load(model: {
modelName: AvailableModels;
encoderSource?: ResourceSource;
decoderSource?: ResourceSource;
tokenizerSource?: ResourceSource;
}, onDownloadProgressCallback?: (progress: number) => void): Promise<void>;
configureStreaming(overlapSeconds: Parameters<SpeechToTextController['configureStreaming']>[0], windowSize: Parameters<SpeechToTextController['configureStreaming']>[1], streamingConfig: Parameters<SpeechToTextController['configureStreaming']>[2]): void;
encode(waveform: Float32Array): Promise<null>;
decode(seq: number[]): Promise<number>;
transcribe(waveform: number[], audioLanguage?: SpeechToTextLanguage): ReturnType<SpeechToTextController['transcribe']>;
streamingTranscribe(streamAction: STREAMING_ACTION, waveform?: number[], audioLanguage?: SpeechToTextLanguage): ReturnType<SpeechToTextController['streamingTranscribe']>;
}