#whisper #transcription #ai

rwhisper

A simple interface for Whisper transcription models in Rust

10 releases

0.3.5 Aug 28, 2024
0.3.4 Aug 24, 2024
0.2.1 Feb 28, 2024
0.1.2 Dec 21, 2023

#470 in Audio

Download history 2/week @ 2024-07-21 63/week @ 2024-07-28 6/week @ 2024-08-04 246/week @ 2024-08-11 267/week @ 2024-08-18 209/week @ 2024-08-25 21/week @ 2024-09-01 8/week @ 2024-09-08 187/week @ 2024-09-15 110/week @ 2024-09-22 123/week @ 2024-09-29 45/week @ 2024-10-06 60/week @ 2024-10-13 32/week @ 2024-10-20 42/week @ 2024-10-27 20/week @ 2024-11-03

157 downloads per month
Used in 3 crates (via kalosm-sound)

MIT/Apache

505KB
4.5K 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.
    while let Some(text) = text.next().await {
        print!("{}", text.text());
    }

    Ok(())
}

Dependencies

~36–78MB
~1.5M SLoC