MCPcopy Create free account
hub / github.com/evilsocket/cake / get

Method get

cake-core/src/models/flux/config.rs:35–54  ·  view source on GitHub ↗

Download and return the primary file path for this component.

(&self, repo_id: &str, cache_dir: &str)

Source from the content-addressed store, hash-verified

33
34 /// Download and return the primary file path for this component.
35 pub fn get(&self, repo_id: &str, cache_dir: &str) -> Result<PathBuf> {
36 let mut cache_path = PathBuf::from(cache_dir);
37 cache_path.push("hub");
38 let cache = Cache::new(cache_path);
39 let api = ApiBuilder::from_cache(cache).build()?;
40 let repo = api.model(repo_id.to_string());
41
42 let files = self.files();
43 let mut primary_path = None;
44 for file in &files {
45 log::info!("downloading {} ...", file);
46 let path = repo
47 .get(file)
48 .map_err(|e| anyhow::anyhow!("failed to download {}: {}", file, e))?;
49 if primary_path.is_none() {
50 primary_path = Some(path);
51 }
52 }
53 Ok(primary_path.unwrap())
54 }
55
56 /// Get all downloaded file paths for this component.
57 pub fn get_all(&self, repo_id: &str, cache_dir: &str) -> Result<Vec<PathBuf>> {

Callers 12

get_allMethod · 0.45
newMethod · 0.45
loadMethod · 0.45
generate_imageMethod · 0.45
loadMethod · 0.45
loadMethod · 0.45
load_t5_tokenizerFunction · 0.45
loadMethod · 0.45
load_modelMethod · 0.45
load_modelMethod · 0.45
loadMethod · 0.45
load_modelMethod · 0.45

Calls 3

filesMethod · 0.80
repo_and_fileMethod · 0.80
pushMethod · 0.45

Tested by

no test coverage detected