Skip to content

YC (S26) | Open Computer History | Continuously record your company computer work, map your workflows, help you find work worth automating, and power your agents' context

fix: tests/ci

Louis Beaumont0e4e71f7bc79
diff --git a/screenpipe-audio/examples/stt.rs b/screenpipe-audio/examples/stt.rs
index 40ac992f8..6e299304a 100644
--- a/screenpipe-audio/examples/stt.rs
+++ b/screenpipe-audio/examples/stt.rs
@@ -58,8 +58,9 @@ async fn main() {
// Add more test cases as needed
];
- let whisper_model =
- Arc::new(WhisperModel::new(&AudioTranscriptionEngine::WhisperLargeV3Turbo).unwrap());
+ let whisper_model = Arc::new(Mutex::new(
+ WhisperModel::new(&AudioTranscriptionEngine::WhisperLargeV3Turbo).unwrap(),
+ ));
let vad_engine: Arc<Mutex<Box<dyn VadEngine + Send>>> =
Arc::new(Mutex::new(Box::new(SileroVad::new().await.unwrap())));
let output_path = Arc::new(PathBuf::from("test_output"));
@@ -84,18 +85,20 @@ async fn main() {
};
let mut vad_engine_guard = vad_engine.lock().await;
+ let mut whisper_model_guard = whisper_model.lock().await;
let (transcription, _) = stt(
&audio_input,
- &whisper_model,
+ &mut *whisper_model_guard,
Arc::new(AudioTranscriptionEngine::WhisperLargeV3Turbo),
&mut **vad_engine_guard,
None,
&output_path,
true,
)
- .await
- .unwrap();
+ .await
+ .unwrap();
drop(vad_engine_guard);
+ drop(whisper_model_guard);
let distance = levenshtein(expected_transcription, &transcription);
let accuracy = 1.0 - (distance as f64 / expected_transcription.len() as f64);
diff --git a/screenpipe-audio/tests/accuracy_test.rs b/screenpipe-audio/tests/accuracy_test.rs
index 2739b6f22..b9ef595d8 100644
--- a/screenpipe-audio/tests/accuracy_test.rs
+++ b/screenpipe-audio/tests/accuracy_test.rs
@@ -58,8 +58,9 @@ async fn test_transcription_accuracy() {
// Add more test cases as needed
];
- let whisper_model =
- Arc::new(WhisperModel::new(&AudioTranscriptionEngine::WhisperLargeV3Turbo).unwrap());
+ let whisper_model = Arc::new(Mutex::new(
+ WhisperModel::new(&AudioTranscriptionEngine::WhisperLargeV3Turbo).unwrap(),
+ ));
let vad_engine: Arc<Mutex<Box<dyn VadEngine + Send>>> =
Arc::new(Mutex::new(Box::new(SileroVad::new().await.unwrap())));
let output_path = Arc::new(PathBuf::from("test_output"));
@@ -84,9 +85,10 @@ async fn test_transcription_accuracy() {
};
let mut vad_engine_guard = vad_engine.lock().await;
+ let mut whisper_model_guard = whisper_model.lock().await;
let (transcription, _) = stt(
&audio_input,
- &whisper_model,
+ &mut *whisper_model_guard,
Arc::new(AudioTranscriptionEngine::WhisperLargeV3Turbo),
&mut **vad_engine_guard,
None,
@@ -96,6 +98,7 @@ async fn test_transcription_accuracy() {
.await
.unwrap();
drop(vad_engine_guard);
+ drop(whisper_model_guard);
let distance = levenshtein(expected_transcription, &transcription);
let accuracy = 1.0 - (distance as f64 / expected_transcription.len() as f64);
@@ -112,7 +115,7 @@ async fn test_transcription_accuracy() {
let mut total_tests = 0;
for result in results {
- let (audio_file, expected_transcription, transcription, accuracy) = result.unwrap();
+ let (audio_file, _, __, accuracy) = result.unwrap();
println!("file: {}", audio_file);
// println!("expected: {}", expected_transcription);
diff --git a/screenpipe-audio/tests/core_tests.rs b/screenpipe-audio/tests/core_tests.rs
index 36d61f442..c16ec69d2 100644
--- a/screenpipe-audio/tests/core_tests.rs
+++ b/screenpipe-audio/tests/core_tests.rs
@@ -288,7 +288,7 @@ mod tests {
};
// Initialize the WhisperModel
- let whisper_model = WhisperModel::new(&AudioTranscriptionEngine::WhisperDistilLargeV3)
+ let mut whisper_model = WhisperModel::new(&AudioTranscriptionEngine::WhisperLargeV3Turbo)
.expect("Failed to initialize WhisperModel");
// Initialize VAD engine
@@ -300,7 +300,7 @@ mod tests {
let _ = stt(
&audio_input,
- &whisper_model,
+ &mut whisper_model,
Arc::new(AudioTranscriptionEngine::WhisperTiny),
&mut **vad_engine.lock().unwrap(),
None,