no buffer
parent
532ae22908
commit
116f3f58c9
|
|
@ -8,7 +8,7 @@ use std::thread;
|
|||
|
||||
#[derive(Parser, Debug)]
|
||||
struct Flags {
|
||||
#[arg(long, default_value = "../models/ggml-tiny.en.bin")]
|
||||
#[arg(long, default_value = "./models/ggml-tiny.en.bin")]
|
||||
model: String,
|
||||
|
||||
#[arg(long, default_value = "8")]
|
||||
|
|
@ -85,7 +85,7 @@ fn new_whisper(model_path: String, threads: i32, handler: Handler) -> Result<Whi
|
|||
|
||||
impl Whisper {
|
||||
fn transcribe(&self, data: &Vec<f32>) {
|
||||
let (send, recv) = std::sync::mpsc::sync_channel(1);
|
||||
let (send, recv) = std::sync::mpsc::sync_channel(0);
|
||||
self._transcribe_async(data, Some(send)).unwrap();
|
||||
recv.recv().unwrap();
|
||||
}
|
||||
|
|
@ -191,7 +191,7 @@ fn new_listener() -> Listener {
|
|||
|
||||
impl Listener {
|
||||
fn listen(self, mut cb: impl FnMut(Vec<f32>)) {
|
||||
let (send, recv) = std::sync::mpsc::sync_channel(5_000);
|
||||
let (send, recv) = std::sync::mpsc::sync_channel(100);
|
||||
thread::spawn(move || { self._listen(send); });
|
||||
loop {
|
||||
match recv.recv() {
|
||||
|
|
|
|||
Loading…
Reference in New Issue