From 7a5db3b2ac06ac663b255bf8cef2ab7882ec2735 Mon Sep 17 00:00:00 2001 From: Bel LaPointe <153096461+breel-render@users.noreply.github.com> Date: Tue, 2 Jan 2024 16:29:58 -0700 Subject: [PATCH] no callback on empty str --- rust-whisper-lib/src/lib.rs | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/rust-whisper-lib/src/lib.rs b/rust-whisper-lib/src/lib.rs index 4b7e109..08509b6 100644 --- a/rust-whisper-lib/src/lib.rs +++ b/rust-whisper-lib/src/lib.rs @@ -230,7 +230,9 @@ impl Impl { let result = whispered .after(&(self.stream_head * 100.0)) .before(&(self.stream_tail * 100.0)); - (self.handler_fn.as_mut().unwrap())(Ok(result)); + if result.to_string().trim().len() > 0 { + (self.handler_fn.as_mut().unwrap())(Ok(result)); + } } fn on_error(&mut self, msg: String) {