Skip to content

armgit / Handy

Public Imported from GitHub
0

A free, open source, and extensible speech-to-text application that works completely offline.

Remove extraneous logging

CJ Paisaef769973496
diff --git a/src-tauri/Cargo.lock b/src-tauri/Cargo.lock
index c5dd1275..12473f43 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 2d78ee2c..51709b0d 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 892c755a..a4114ab1 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<Self> {
+ 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)