rust works ok with base and even **gb1

master
Bel LaPointe 2023-03-31 10:16:23 -06:00
parent b2e636b984
commit 7b25bfa8d3
1 changed files with 6 additions and 2 deletions

View File

@ -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");