1This example project demonstrates using the `wasi-nn` API to perform WinML-based 2inference. We first build Wasmtime, a fast and secure runtime for WebAssembly, 3and then build a WebAssembly example, which: 4- reads an input image from [`fixture/kitten.png`], 5- converts it to the correct tensor format, 6- and then classifies the image using [`fixture/mobilenet.onnx`] 7 8[`fixture/kitten.png`]: fixture/kitten.png 9[`fixture/mobilenet.onnx`]: fixture/mobilenet.onnx 10[`src/main.rs`]: src/main.rs 11[build guide]: https://docs.wasmtime.dev/contributing-building.html 12 13To run this example, perform the following steps on Windows 10 v1803 and later: 14 151. Build Wasmtime according to the [build guide], but enable the `winml` 16 feature: 17 ```console 18 cargo build --release --features wasmtime-wasi-nn/winml 19 ``` 201. Navigate to this directory from Wasmtime's top-level directory (referred to 21 later as `%PROJECT_DIR%). 22 ``` 23 set PROJECT_DIR=%CD% 24 cd crates\wasi-nn\examples\classification-example-winml 25 ``` 261. Install the `wasm32-wasip1` Rust target: 27 ``` 28 rustup target add wasm32-wasip1 29 ``` 301. Compile this example; the `wasm32-wasip1` output is a WebAssembly file: 31 ``` 32 cargo build --release --target=wasm32-wasip1 33 ``` 341. Run the sample; the fixture directory containing the model and image must be 35 mapped in to be accessible to WebAssembly. 36 ``` 37 %PROJECT_DIR%\target\release\wasmtime.exe --dir fixture::fixture -S nn target\wasm32-wasip1\release\wasi-nn-example-winml.wasm 38 ``` 391. The example will print the top 5 classification results. To run with a 40 different image or ONNX model, modify the files in the `fixture` directory 41 along with any path changes this may cause [`src/main.rs`]. 42