reduce whisper-rs space

master
Bel LaPointe 2023-12-21 22:15:00 -05:00
parent 29ff174f5d
commit 1cceb773f2
3 changed files with 35 additions and 4088 deletions

File diff suppressed because it is too large Load Diff

View File

@ -7,6 +7,5 @@ edition = "2021"
[dependencies]
whisper-rs = { path = "../gitea-whisper-rs", version = "0.8.0" }
whisper = { path = "../whisper-burn", version = "0.1.0", features = ["wgpu-backend"] }
clap = { version = "4.4.10", features = ["derive"] }
wav = "1"

View File

@ -61,7 +61,13 @@ fn f32_from_wav_file(path: &String) -> Result<Vec<f32>, String> {
return Err("!= 16_000 hz".to_string());
}
match data.as_sixteen() {
Some(data16) => Ok(whisper_rs::convert_integer_to_float_audio(&data16)),
Some(data16) => {
let mut floats = Vec::with_capacity(data16.len());
for sample in data16 {
floats.push(*sample as f32 / 32768.0);
}
Ok(floats)
},
None => Err(format!("couldnt translate wav to 16s")),
}
}