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 model download ux (#1780)

shaik-zeeshand884db2af59d
diff --git a/screenpipe-app-tauri/components/model-download-tracker.tsx b/screenpipe-app-tauri/components/model-download-tracker.tsx
index f18575b56..d7b6420f0 100644
--- a/screenpipe-app-tauri/components/model-download-tracker.tsx
+++ b/screenpipe-app-tauri/components/model-download-tracker.tsx
@@ -77,6 +77,7 @@ export function ModelDownloadTracker() {
{ regex: /successfully downloaded ([^,]+)/, group: 1 },
{ regex: /model ([\w-]+) downloaded/, group: 1 },
{ regex: /model ([\w-]+) downloaded/, group: 1 },
+ { regex: /model.*downloaded.*?([\w-]+)/, group: 1 },
{ regex: /model downloaded/, group: 1 },
];
diff --git a/screenpipe-audio/src/transcription/whisper/model.rs b/screenpipe-audio/src/transcription/whisper/model.rs
index 7c5df010d..16e91f640 100644
--- a/screenpipe-audio/src/transcription/whisper/model.rs
+++ b/screenpipe-audio/src/transcription/whisper/model.rs
@@ -1,20 +1,11 @@
use crate::core::engine::AudioTranscriptionEngine;
use anyhow::Result;
-use hf_hub::{api::sync::Api, Repo, RepoType};
+use hf_hub::{api::sync::Api, Cache, Repo, RepoType};
use std::{path::PathBuf, sync::Arc};
use tracing::info;
use whisper_rs::WhisperContextParameters;
pub fn download_whisper_model(engine: Arc<AudioTranscriptionEngine>) -> Result<PathBuf> {
- let api = Api::new()?;
- let repo = Repo::with_revision(
- "ggerganov/whisper.cpp".to_string(),
- RepoType::Model,
- "main".to_string(),
- );
- let api_repo = api.repo(repo);
-
- info!("downloading model {:?}", engine);
let model_name = match *engine {
AudioTranscriptionEngine::WhisperLargeV3Turbo => "ggml-large-v3-turbo.bin",
AudioTranscriptionEngine::WhisperTiny => "ggml-tiny.bin",
@@ -24,11 +15,29 @@ pub fn download_whisper_model(engine: Arc<AudioTranscriptionEngine>) -> Result<P
_ => "ggml-large-v3-turbo-q8_0.bin",
};
+ let api = Api::new()?;
+ let repo = Repo::with_revision(
+ "ggerganov/whisper.cpp".to_string(),
+ RepoType::Model,
+ "main".to_string(),
+ );
+
+ let cache = Cache::default();
+ let cache_repo = cache.repo(repo.clone());
+
+ if let Some(model_path) = cache_repo.get(model_name) {
+ info!("model found at {:?}", model_path);
+ return Ok(model_path);
+ }
+
+ let api_repo = api.repo(repo);
+
+ info!("downloading model {:?}", model_name);
let model = api_repo.get(model_name)?;
info!("model downloaded {}", model_name);
- Ok(model)
+ return Ok(model);
}
pub fn create_whisper_context_parameters<'a>(