better default err msgs
parent
6dffa401b7
commit
f58e3a0331
|
|
@ -3,13 +3,13 @@ use whisper_rs::{WhisperContext, FullParams, SamplingStrategy};
|
|||
fn main() {
|
||||
let ctx = WhisperContext::new(
|
||||
&std::env::var("MODEL").unwrap_or(String::from("../models/ggml-tiny.en.bin"))
|
||||
).expect("failed to load model");
|
||||
).expect("failed to load $MODEL");
|
||||
let mut state = ctx.create_state().expect("failed to create state");
|
||||
|
||||
// create a params object
|
||||
let mut params = FullParams::new(SamplingStrategy::Greedy { best_of: 0 });
|
||||
params.set_n_threads(
|
||||
std::env::var("P").unwrap_or(String::from("1")).parse::<i32>().expect("$P must be a number")
|
||||
std::env::var("P").unwrap_or(String::from("8")).parse::<i32>().expect("$P must be a number")
|
||||
);
|
||||
params.set_translate(false);
|
||||
params.set_detect_language(false);
|
||||
|
|
@ -21,7 +21,7 @@ fn main() {
|
|||
|
||||
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");
|
||||
).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");
|
||||
|
|
|
|||
Loading…
Reference in New Issue