Crate rwhisper

Crate rwhisper 

Source
Expand description

§rwhisper

A Rust wrapper for whisper

§Usage

use futures_util::StreamExt;
use kalosm::sound::*;
use tokio::time::{Duration, Instant};

#[tokio::main]
async fn main() -> Result<(), anyhow::Error> {
    // Create a new small whisper model.
    let model = WhisperBuilder::default()
        .with_source(WhisperSource::SmallEn)
        .build()
        .await?;

    // Record audio from the microphone for 5 seconds.
    let audio = MicInput::default()
        .record_until(Instant::now() + Duration::from_secs(5))
        .await;

    // Transcribe the audio.
    let mut text = model.transcribe(audio);

    // As the model transcribes the audio, print the text to the console.
    text.to_std_out().await.unwrap();

    Ok(())
}

Structs§

ChunkedTranscriptionTask
A chunked audio transcription task which can be streamed from a Whisper model.
ParseWhisperLanguageError
Error that reports the unsupported value
ParseWhisperSourceError
Error that reports the unsupported value
Segment
A transcribed segment of audio.
TokenChunkRef
A reference to a utf8 token chunk in a segment.
TranscriptionTask
A transcription task which can be streamed from a Whisper model.
Whisper
A quantized whisper audio transcription model.
WhisperBuilder
A builder with configuration for a Whisper model.

Enums§

FileSource
A source for a file, either from Hugging Face or a local path
ModelLoadingProgress
The progress starting a model
WhisperLanguage
A language whisper can use
WhisperSource
The source whisper model to use.

Traits§

TranscribeChunkedAudioStreamExt
An extension trait to transcribe pre-chunked audio streams