22 lines
770 B
Rust
22 lines
770 B
Rust
use rust_whisper_lib;
|
|
|
|
pub fn channel<F>(
|
|
mut flags: rust_whisper_lib::Flags,
|
|
handler_fn: F,
|
|
stream: std::sync::mpsc::Receiver<Vec<f32>>,
|
|
) where F: FnMut(Result<rust_whisper_lib::Transcribed, String>) + Send + 'static {
|
|
flags.model_path = None;
|
|
flags.model_buffer = Some(include_bytes!("../../models/ggml-small.en.bin").to_vec());
|
|
rust_whisper_lib::channel(flags.clone(), handler_fn, stream);
|
|
}
|
|
|
|
pub fn wav<F>(
|
|
mut flags: rust_whisper_lib::Flags,
|
|
handler_fn: F
|
|
) where F: FnMut(Result<rust_whisper_lib::Transcribed, String>) + Send + 'static {
|
|
flags.model_path = None;
|
|
flags.model_buffer = Some(include_bytes!("../../models/ggml-distil-medium.en.bin").to_vec());
|
|
rust_whisper_lib::wav(flags.clone(), handler_fn, flags.wav.unwrap());
|
|
}
|
|
|