File: README.md

package info (click to toggle)
rust-wasmtime 26.0.1%2Bdfsg-3
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid, trixie
  • size: 48,492 kB
  • sloc: ansic: 4,003; sh: 561; javascript: 542; cpp: 254; asm: 175; ml: 96; makefile: 55
file content (23 lines) | stat: -rw-r--r-- 969 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
# Onnx Backend Classification Component Example

This example demonstrates how to use the `wasi-nn` crate to run a classification using the
[ONNX Runtime](https://onnxruntime.ai/) backend from a WebAssembly component.

## Build
In this directory, run the following command to build the WebAssembly component:
```shell
cargo component build
```

In the wasmtime root directory, run the following command to build the wasmtime CLI and run the WebAssembly component:
```shell
# build wasmtime with component-model and WASI-NN with ONNX runtime support
cargo build --features component-model,wasi-nn,wasmtime-wasi-nn/onnx

# run the component with wasmtime
./target/debug/wasmtime run \
  --wasm-features component-model \
  --wasi-modules=experimental-wasi-nn \
  --mapdir fixture::./crates/wasi-nn/examples/classification-component-onnx/fixture \
  ./crates/wasi-nn/examples/classification-component-onnx/target/wasm32-wasip1/debug/classification_component_onnx.wasm
```