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§
- Chunked
Transcription Task - A chunked audio transcription task which can be streamed from a
Whispermodel. - Parse
Whisper Language Error - Error that reports the unsupported value
- Parse
Whisper Source Error - Error that reports the unsupported value
- Segment
- A transcribed segment of audio.
- Token
Chunk Ref - A reference to a utf8 token chunk in a segment.
- Transcription
Task - A transcription task which can be streamed from a
Whispermodel. - Whisper
- A quantized whisper audio transcription model.
- Whisper
Builder - A builder with configuration for a Whisper model.
Enums§
- File
Source - A source for a file, either from Hugging Face or a local path
- Model
Loading Progress - The progress starting a model
- Whisper
Language - A language whisper can use
- Whisper
Source - The source whisper model to use.
Traits§
- Transcribe
Chunked Audio Stream Ext - An extension trait to transcribe pre-chunked audio streams