baked-lib to ::wav, ::stream

This commit is contained in:
Bel LaPointe
2023-12-20 09:38:29 -05:00
parent 4f44697ef0
commit 1e56d44b2f
2 changed files with 21 additions and 572 deletions

View File

@@ -1,10 +1,20 @@
use rust_whisper_lib;
pub fn main<F>(
pub fn wav<F>(
mut flags: rust_whisper_lib::Flags,
handler_fn: F
) where F: FnMut(Result<rust_whisper_lib::Whispered, String>) + Send + 'static {
) where F: FnMut(Result<rust_whisper_lib::Transcribed, String>) + Send + 'static {
flags.model_path = None;
flags.model_buffer = Some(include_bytes!("../../models/ggml-tiny.en.bin").to_vec());
rust_whisper_lib::main(flags, handler_fn);
rust_whisper_lib::wav(flags.clone(), handler_fn, flags.wav.unwrap());
}
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-tiny.en.bin").to_vec());
rust_whisper_lib::channel(flags.clone(), handler_fn, stream);
}