fix so each buffer page isnt stream_step from last BUT stream_step of content

This commit is contained in:
Bel LaPointe
2023-12-20 23:43:06 -05:00
parent 6bb29c106f
commit e74a5ac0ca
2 changed files with 12 additions and 15 deletions

View File

@@ -1,20 +1,21 @@
use rust_whisper_lib;
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-small.en.bin").to_vec());
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());
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-large-v2.bin").to_vec());
rust_whisper_lib::wav(flags.clone(), handler_fn, flags.wav.unwrap());
}