react-native-executorch
Version:
An easy way to run AI models in React Native with ExecuTorch
28 lines (27 loc) • 1.45 kB
TypeScript
import { SpeechToTextController } from '../../controllers/SpeechToTextController';
import { ResourceSource } from '../../types/common';
import { STREAMING_ACTION } from '../../constants/sttDefaults';
import { AvailableModels, SpeechToTextLanguage } from '../../types/stt';
interface SpeechToTextModule {
isReady: boolean;
isGenerating: boolean;
sequence: string;
downloadProgress: number;
configureStreaming: SpeechToTextController['configureStreaming'];
error: Error | undefined;
transcribe: (input: number[], audioLanguage?: SpeechToTextLanguage) => ReturnType<SpeechToTextController['transcribe']>;
streamingTranscribe: (streamAction: STREAMING_ACTION, input?: number[], audioLanguage?: SpeechToTextLanguage) => ReturnType<SpeechToTextController['streamingTranscribe']>;
}
export declare const useSpeechToText: ({ model, overlapSeconds, windowSize, streamingConfig, preventLoad, }: {
model: {
modelName: AvailableModels;
encoderSource: ResourceSource;
decoderSource: ResourceSource;
tokenizerSource: ResourceSource;
};
overlapSeconds?: ConstructorParameters<typeof SpeechToTextController>["0"]["overlapSeconds"];
windowSize?: ConstructorParameters<typeof SpeechToTextController>["0"]["windowSize"];
streamingConfig?: ConstructorParameters<typeof SpeechToTextController>["0"]["streamingConfig"];
preventLoad?: boolean;
}) => SpeechToTextModule;
export {};