#whisper #transcription #ai

rwhisper

A simple interface for Whisper transcription models in Rust

11 unstable releases (3 breaking)

0.4.0 Feb 9, 2025
0.3.5 Aug 28, 2024
0.2.1 Feb 28, 2024
0.1.2 Dec 21, 2023

#301 in Audio

Download history 43/week @ 2024-10-29 17/week @ 2024-11-05 31/week @ 2024-11-12 42/week @ 2024-11-19 45/week @ 2024-11-26 51/week @ 2024-12-03 78/week @ 2024-12-10 49/week @ 2024-12-17 20/week @ 2024-12-24 64/week @ 2024-12-31 36/week @ 2025-01-07 49/week @ 2025-01-14 31/week @ 2025-01-21 22/week @ 2025-01-28 150/week @ 2025-02-04 72/week @ 2025-02-11

283 downloads per month
Used in 2 crates (via kalosm-sound)

MIT/Apache

600KB
7K SLoC

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(())
}

Dependencies

~32–77MB
~1.5M SLoC