from borrow since a grant is K
parent
ec6a71d38c
commit
03370f362e
|
|
@ -104,7 +104,7 @@ struct WhisperService {
|
||||||
jobs: std::sync::mpsc::SyncSender<AWhisper>,
|
jobs: std::sync::mpsc::SyncSender<AWhisper>,
|
||||||
}
|
}
|
||||||
|
|
||||||
fn new_whisper_service(model_path: String, threads: i32, stream_head: f32, stream_tail: f32, handler_fn: fn(Result<&Whispered, String>)) -> Result<WhisperService, String> {
|
fn new_whisper_service(model_path: String, threads: i32, stream_head: f32, stream_tail: f32, handler_fn: fn(Result<Whispered, String>)) -> Result<WhisperService, String> {
|
||||||
match new_whisper_engine(model_path, threads) {
|
match new_whisper_engine(model_path, threads) {
|
||||||
Ok(engine) => {
|
Ok(engine) => {
|
||||||
let whisper = new_whisper_impl(engine, stream_head, stream_tail, handler_fn);
|
let whisper = new_whisper_impl(engine, stream_head, stream_tail, handler_fn);
|
||||||
|
|
@ -142,10 +142,10 @@ struct WhisperImpl {
|
||||||
engine: WhisperEngine,
|
engine: WhisperEngine,
|
||||||
stream_head: f32,
|
stream_head: f32,
|
||||||
stream_tail: f32,
|
stream_tail: f32,
|
||||||
handler_fn: fn(Result<&Whispered, String>),
|
handler_fn: fn(Result<Whispered, String>),
|
||||||
}
|
}
|
||||||
|
|
||||||
fn new_whisper_impl(engine: WhisperEngine, stream_head: f32, stream_tail: f32, handler_fn: fn(Result<&Whispered, String>)) -> WhisperImpl {
|
fn new_whisper_impl(engine: WhisperEngine, stream_head: f32, stream_tail: f32, handler_fn: fn(Result<Whispered, String>)) -> WhisperImpl {
|
||||||
WhisperImpl {
|
WhisperImpl {
|
||||||
engine: engine,
|
engine: engine,
|
||||||
stream_head: stream_head,
|
stream_head: stream_head,
|
||||||
|
|
@ -189,7 +189,7 @@ impl WhisperImpl {
|
||||||
let result = whispered
|
let result = whispered
|
||||||
.after(&(self.stream_head * 100.0))
|
.after(&(self.stream_head * 100.0))
|
||||||
.before(&(self.stream_tail * 100.0));
|
.before(&(self.stream_tail * 100.0));
|
||||||
(self.handler_fn)(Ok(&result));
|
(self.handler_fn)(Ok(result));
|
||||||
}
|
}
|
||||||
|
|
||||||
fn on_error(&self, msg: String) {
|
fn on_error(&self, msg: String) {
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue