Refine semantic search and CPU fallback

- make Candle CUDA support opt-in so default builds work on CPU-only machines
- improve semantic search loading and empty states in the gallery
- keep semantic search UX clearer when no matches are found

Refs: #4
This commit is contained in:
2026-04-06 02:26:43 +01:00
parent c6a66d1ba9
commit da9a20f8f7
3 changed files with 47 additions and 16 deletions
+8 -11
View File
@@ -84,21 +84,18 @@ impl ClipImageEmbedder {
}
fn resolve_device() -> Result<Device> {
let cuda_device = Device::cuda_if_available(0)?;
if cuda_device.is_cuda() {
println!("CLIP embedder using CUDA device.");
return Ok(cuda_device);
}
#[cfg(target_os = "macos")]
#[cfg(feature = "candle-cuda")]
{
let metal_device = Device::metal_if_available(0)?;
if metal_device.is_metal() {
println!("CLIP embedder using Metal device.");
return Ok(metal_device);
let cuda_device = Device::cuda_if_available(0)?;
if cuda_device.is_cuda() {
println!("CLIP embedder using CUDA device.");
return Ok(cuda_device);
}
}
#[cfg(not(feature = "candle-cuda"))]
println!("CLIP embedder built without CUDA support.");
println!("CLIP embedder using CPU device.");
Ok(Device::Cpu)
}