reduce whisper-rs space
parent
29ff174f5d
commit
1cceb773f2
File diff suppressed because it is too large
Load Diff
|
|
@ -7,6 +7,5 @@ edition = "2021"
|
||||||
|
|
||||||
[dependencies]
|
[dependencies]
|
||||||
whisper-rs = { path = "../gitea-whisper-rs", version = "0.8.0" }
|
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"] }
|
clap = { version = "4.4.10", features = ["derive"] }
|
||||||
wav = "1"
|
wav = "1"
|
||||||
|
|
|
||||||
|
|
@ -61,7 +61,13 @@ fn f32_from_wav_file(path: &String) -> Result<Vec<f32>, String> {
|
||||||
return Err("!= 16_000 hz".to_string());
|
return Err("!= 16_000 hz".to_string());
|
||||||
}
|
}
|
||||||
match data.as_sixteen() {
|
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")),
|
None => Err(format!("couldnt translate wav to 16s")),
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue