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