rust works ok with base and even **gb1
parent
b2e636b984
commit
7b25bfa8d3
|
|
@ -1,7 +1,9 @@
|
||||||
use whisper_rs::{WhisperContext, FullParams, SamplingStrategy};
|
use whisper_rs::{WhisperContext, FullParams, SamplingStrategy};
|
||||||
|
|
||||||
fn main() {
|
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
|
// create a params object
|
||||||
let mut params = FullParams::new(SamplingStrategy::Greedy { best_of: 0 });
|
let mut params = FullParams::new(SamplingStrategy::Greedy { best_of: 0 });
|
||||||
|
|
@ -16,7 +18,9 @@ fn main() {
|
||||||
// assume we have a buffer of audio data
|
// assume we have a buffer of audio data
|
||||||
// here we'll make a fake one, floating point samples, 32 bit, 16KHz, mono
|
// here we'll make a fake one, floating point samples, 32 bit, 16KHz, mono
|
||||||
//let audio_data = vec![0_f32; 16000 * 2];
|
//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.channel_count == 1);
|
||||||
assert!(header.sampling_rate == 16000);
|
assert!(header.sampling_rate == 16000);
|
||||||
let data16 = data.as_sixteen().expect("wav is not 32bit floats");
|
let data16 = data.as_sixteen().expect("wav is not 32bit floats");
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue