From aef769973496d05d876c32561aaa74267ed21d39 Mon Sep 17 00:00:00 2001 From: CJ Pais Date: Fri, 14 Feb 2025 16:39:50 -0800 Subject: [PATCH] Remove extraneous logging --- src-tauri/Cargo.lock | 1 + src-tauri/Cargo.toml | 2 +- src-tauri/src/managers/transcription.rs | 5 ++++- 3 files changed, 6 insertions(+), 2 deletions(-) diff --git a/src-tauri/Cargo.lock b/src-tauri/Cargo.lock index c5dd127..12473f4 100644 --- a/src-tauri/Cargo.lock +++ b/src-tauri/Cargo.lock @@ -5529,6 +5529,7 @@ version = "0.13.2" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "40b6fc553156b521663bfa8e713e7ad58c7ca262d46de9998cd7f2e4de5ba0d9" dependencies = [ + "log", "whisper-rs-sys", ] diff --git a/src-tauri/Cargo.toml b/src-tauri/Cargo.toml index 2d78ee2..51709b0 100644 --- a/src-tauri/Cargo.toml +++ b/src-tauri/Cargo.toml @@ -26,7 +26,7 @@ tauri-plugin-clipboard-manager = "2" tauri-plugin-macos-permissions = "2.0.4" rdev = { git = "https://github.com/rustdesk-org/rdev" } cpal = "0.15.3" -whisper-rs = { version = "0.13.2" } +whisper-rs = { version = "0.13.2", features = ["whisper-cpp-log"] } anyhow = "1.0.95" rubato = "0.16.1" samplerate = "0.2.4" diff --git a/src-tauri/src/managers/transcription.rs b/src-tauri/src/managers/transcription.rs index 892c755..a4114ab 100644 --- a/src-tauri/src/managers/transcription.rs +++ b/src-tauri/src/managers/transcription.rs @@ -1,5 +1,6 @@ use anyhow::Result; use std::sync::Mutex; +use whisper_rs::install_whisper_log_trampoline; use whisper_rs::{ FullParams, SamplingStrategy, WhisperContext, WhisperContextParameters, WhisperState, }; @@ -11,6 +12,7 @@ pub struct TranscriptionManager { impl TranscriptionManager { pub fn new() -> Result { + install_whisper_log_trampoline(); // Load the model let context = WhisperContext::new_with_params( "resources/ggml-small.bin", @@ -33,7 +35,7 @@ impl TranscriptionManager { let mut result = String::new(); println!("Audio vector length: {}", audio.len()); - if (audio.len() == 0) { + if audio.len() == 0 { println!("Empty audio vector"); // TODO error return Ok(result); @@ -46,6 +48,7 @@ impl TranscriptionManager { params.set_print_progress(false); params.set_print_realtime(false); params.set_print_timestamps(false); + params.set_suppress_non_speech_tokens(true); state .full(params, &audio)