1 use anyhow::{Context, Result}; 2 use std::fs; 3 use test_programs::nn::{sort_results, wit}; 4 main() -> Result<()>5pub fn main() -> Result<()> { 6 let xml = fs::read("fixture/model.xml") 7 .context("the model file to be mapped to the fixture directory")?; 8 let weights = fs::read("fixture/model.bin") 9 .context("the weights file to be mapped to the fixture directory")?; 10 let graph = wit::load( 11 &[xml, weights], 12 wit::GraphEncoding::Openvino, 13 wit::ExecutionTarget::Cpu, 14 )?; 15 let tensor = fs::read("fixture/tensor.bgr") 16 .context("the tensor file to be mapped to the fixture directory")?; 17 let results = wit::classify(graph, ("input", tensor))?; 18 let top_five = &sort_results(&results)[..5]; 19 println!("found results, sorted top 5: {top_five:?}"); 20 Ok(()) 21 } 22