Fix examples
This commit is contained in:
parent
b9fdf149be
commit
d9e8713be7
2 changed files with 11 additions and 6 deletions
|
|
@ -39,9 +39,11 @@ pub fn usage() -> Result<(), &'static str> {
|
|||
// note that you don't need to use these, you can do it yourself or any other way you want
|
||||
// these are just provided for convenience
|
||||
// SIMD variants of these functions are also available, but only on nightly Rust: see the docs
|
||||
let audio_data = whisper_rs::convert_stereo_to_mono_audio(
|
||||
&whisper_rs::convert_integer_to_float_audio(&audio_data),
|
||||
)?;
|
||||
let mut inter_audio_data = Vec::with_capacity(audio_data.len());
|
||||
whisper_rs::convert_integer_to_float_audio(&audio_data, &mut inter_audio_data)
|
||||
.expect("failed to convert audio data");
|
||||
let audio_data = whisper_rs::convert_stereo_to_mono_audio(&inter_audio_data)
|
||||
.expect("failed to convert audio data");
|
||||
|
||||
// now we can run the model
|
||||
// note the key we use here is the one we created above
|
||||
|
|
|
|||
|
|
@ -43,12 +43,15 @@ fn main() {
|
|||
}
|
||||
|
||||
let original_samples = parse_wav_file(audio_path);
|
||||
let samples = whisper_rs::convert_integer_to_float_audio(&original_samples);
|
||||
let mut samples = Vec::with_capacity(original_samples.len());
|
||||
whisper_rs::convert_integer_to_float_audio(&original_samples, &mut samples)
|
||||
.expect("failed to convert samples");
|
||||
|
||||
let ctx = WhisperContext::new_with_params(
|
||||
&whisper_path.to_string_lossy(),
|
||||
WhisperContextParameters::default()
|
||||
).expect("failed to open model");
|
||||
WhisperContextParameters::default(),
|
||||
)
|
||||
.expect("failed to open model");
|
||||
let mut state = ctx.create_state().expect("failed to create key");
|
||||
let mut params = FullParams::new(SamplingStrategy::default());
|
||||
params.set_initial_prompt("experience");
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue