MCPcopy Create free account
hub / github.com/acking-you/static_flow / embed_image_bytes_with_model

Function embed_image_bytes_with_model

crates/embedding/src/image.rs:78–93  ·  view source on GitHub ↗

Generate a semantic embedding for an image using a specific fastembed vision model.

(
    bytes: &[u8],
    model: ImageEmbeddingModelChoice,
)

Source from the content-addressed store, hash-verified

76/// Generate a semantic embedding for an image using a specific fastembed vision
77/// model.
78pub fn embed_image_bytes_with_model(
79 bytes: &[u8],
80 model: ImageEmbeddingModelChoice,
81) -> anyhow::Result<Vec<f32>> {
82 #[cfg(not(target_arch = "wasm32"))]
83 {
84 fastembed_image_embedding(bytes, model)
85 }
86
87 #[cfg(target_arch = "wasm32")]
88 {
89 let _ = bytes;
90 let _ = model;
91 anyhow::bail!("image embedding is not supported on wasm32")
92 }
93}
94
95#[cfg(not(target_arch = "wasm32"))]
96fn fastembed_image_embedding(

Callers 1

embed_image_bytesFunction · 0.85

Calls 1

Tested by

no test coverage detected