Components / ModelPicker

ModelPicker

Local AI models to download, try, use and remove.

Example

The component itself, running in WebAssembly, beside its code in a playground. Try it.

Code

use ravenrs::prelude::*;

fn model_picker() -> impl View {
    let choice = |name: &str, status| ModelChoice {
        name: name.into(),
        details: "1.1 GB · License: Apache 2.0".into(),
        status,
        in_use: false,
        result: None,
        error: None,
    };
    // It shows what it is given. `ravenrs_ai::ModelManager` does the work on the desktop.
    ModelPicker::new(vec![
        choice("To download", ModelStatus::Available),
        choice("Arriving", ModelStatus::Downloading(0.4)),
        ModelChoice {
            result: Some("About 20 words per second.".into()),
            ..choice("On this machine", ModelStatus::Installed)
        },
    ])
    .on_test(|_| {})
    .on_use(|_| {})
}

Open in the playground, with every example →

Full API of ModelPicker →