From 7b25bfa8d306eefbb7e27a80f078e4eb8df49af8 Mon Sep 17 00:00:00 2001 From: Bel LaPointe Date: Fri, 31 Mar 2023 10:16:23 -0600 Subject: [PATCH] rust works ok with base and even **gb1 --- whisper-cpp-2023/rust.d/src/main.rs | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/whisper-cpp-2023/rust.d/src/main.rs b/whisper-cpp-2023/rust.d/src/main.rs index a0e2e41..fb16b7c 100644 --- a/whisper-cpp-2023/rust.d/src/main.rs +++ b/whisper-cpp-2023/rust.d/src/main.rs @@ -1,7 +1,9 @@ use whisper_rs::{WhisperContext, FullParams, SamplingStrategy}; fn main() { - let mut ctx = WhisperContext::new("../models/ggml-tiny.en.bin").expect("failed to load model"); + let mut ctx = WhisperContext::new( + &std::env::var("MODEL").unwrap_or(String::from("../models/ggml-medium.en.bin")) + ).expect("failed to load model"); // create a params object let mut params = FullParams::new(SamplingStrategy::Greedy { best_of: 0 }); @@ -16,7 +18,9 @@ fn main() { // assume we have a buffer of audio data // here we'll make a fake one, floating point samples, 32 bit, 16KHz, mono //let audio_data = vec![0_f32; 16000 * 2]; - let (header, data) = wav::read(&mut std::fs::File::open("../git.d/samples/jfk.wav").expect("failed to open .wav")).expect("failed to decode .wav"); + let (header, data) = wav::read(&mut std::fs::File::open( + &std::env::var("WAV").unwrap_or(String::from("../git.d/samples/jfk.wav")) + ).expect("failed to open .wav")).expect("failed to decode .wav"); assert!(header.channel_count == 1); assert!(header.sampling_rate == 16000); let data16 = data.as_sixteen().expect("wav is not 32bit floats");