ok stream les go
parent
437d7cac39
commit
3168968cae
|
|
@ -6,18 +6,23 @@ fn main() {
|
||||||
std::env::var("P").unwrap_or(String::from("8")).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"),
|
||||||
).unwrap();
|
).unwrap();
|
||||||
|
|
||||||
let (header, data) = wav::read(&mut std::fs::File::open(
|
match std::env::var("WAV") {
|
||||||
&std::env::var("WAV").unwrap_or(String::from("../git.d/samples/jfk.wav"))
|
Ok(wav) => {
|
||||||
).expect("failed to open $WAV")).expect("failed to decode $WAV");
|
let (header, data) = wav::read(
|
||||||
assert!(header.channel_count == 1);
|
&mut std::fs::File::open(wav).expect("failed to open $WAV"),
|
||||||
assert!(header.sampling_rate == 16000);
|
).expect("failed to decode $WAV");
|
||||||
let data16 = data.as_sixteen().expect("wav is not 32bit floats");
|
assert!(header.channel_count == 1);
|
||||||
let audio_data = &whisper_rs::convert_integer_to_float_audio(&data16);
|
assert!(header.sampling_rate == 16000);
|
||||||
|
let data16 = data.as_sixteen().expect("wav is not 32bit floats");
|
||||||
|
let audio_data = &whisper_rs::convert_integer_to_float_audio(&data16);
|
||||||
|
|
||||||
for _ in 0..3 {
|
let result = w.transcribe(&audio_data).unwrap();
|
||||||
let result = w.transcribe(&audio_data).unwrap();
|
println!("{}", result);
|
||||||
println!("{}", result);
|
},
|
||||||
}
|
Err(_) => {
|
||||||
|
panic!("not impl stream");
|
||||||
|
},
|
||||||
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
struct Whisper {
|
struct Whisper {
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue