from borrow since a grant is K
parent
ec6a71d38c
commit
03370f362e
|
|
@ -104,7 +104,7 @@ struct WhisperService {
|
|||
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) {
|
||||
Ok(engine) => {
|
||||
let whisper = new_whisper_impl(engine, stream_head, stream_tail, handler_fn);
|
||||
|
|
@ -142,10 +142,10 @@ struct WhisperImpl {
|
|||
engine: WhisperEngine,
|
||||
stream_head: 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 {
|
||||
engine: engine,
|
||||
stream_head: stream_head,
|
||||
|
|
@ -189,7 +189,7 @@ impl WhisperImpl {
|
|||
let result = whispered
|
||||
.after(&(self.stream_head * 100.0))
|
||||
.before(&(self.stream_tail * 100.0));
|
||||
(self.handler_fn)(Ok(&result));
|
||||
(self.handler_fn)(Ok(result));
|
||||
}
|
||||
|
||||
fn on_error(&self, msg: String) {
|
||||
|
|
|
|||
Loading…
Reference in New Issue