-
-
Notifications
You must be signed in to change notification settings - Fork 24
Expand file tree
/
Copy pathCargo.toml
More file actions
69 lines (63 loc) · 2.47 KB
/
Copy pathCargo.toml
File metadata and controls
69 lines (63 loc) · 2.47 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
# Ultralytics 🚀 AGPL-3.0 License - https://ultralytics.com/license
[package]
name = "ultralytics-inference-web"
version = "0.0.41"
edition = "2024"
rust-version = "1.89"
description = "Browser/WebAssembly bindings for ultralytics-inference (WebGPU via ort-web)"
license = "AGPL-3.0"
repository = "https://github.com/ultralytics/inference"
publish = false
[lib]
crate-type = ["cdylib", "rlib"]
[lints.rust]
unsafe_code = "warn"
missing_docs = "warn"
[dependencies]
# Reuse the wasm-safe core pipeline (preprocessing, postprocessing, results,
# metadata, task). `default-features = false` drops the native backend modules.
ultralytics-inference = { path = "../..", default-features = false }
# Everything below is only ever compiled for the browser. Keeping these under a
# wasm32 target table means a host build of the workspace never pulls ort with
# `alternative-backend` (which would clash with the native crate's
# `download-binaries` ort under Cargo feature unification) and never tries to
# build the browser-only crates for the host.
[target.'cfg(target_arch = "wasm32")'.dependencies]
# The browser runtime is whatever ort-web pins (0.3.0 pins ONNX Runtime 1.27), so it can
# trail the native crate by a minor version until a matching ort-web is published. Uses
# `alternative-backend` so ort bridges to ort-web instead of linking the native runtime.
ort = { version = "=2.0.0-rc.13", default-features = false, features = [
"std",
"ndarray",
"alternative-backend",
"half",
] }
ort-web = "0.3.0"
wasm-bindgen = "0.2.126"
wasm-bindgen-futures = "0.4"
js-sys = "0.3"
serde = { version = "1", features = ["derive"] }
serde_bytes = "0.11"
serde-wasm-bindgen = "0.6"
# Read the `metadata.json` embedded in a single-file `.tflite` (see tflite_meta).
serde_json = "1"
miniz_oxide = "0.9"
console_error_panic_hook = "0.1"
ndarray = "0.17"
half = "2.7"
web-sys = { version = "0.3", features = ["Window", "Performance"] }
# Decode JPEG/PNG image bytes handed in from JavaScript.
image = { version = "0.25", default-features = false, features = ["jpeg", "png"] }
[package.metadata.wasm-pack.profile.release]
# Smaller, faster-to-load wasm. The bindings pull in SIMD and reference-type
# instructions, so wasm-opt must be told to accept those features (otherwise it
# fails validation on the v128 ops).
wasm-opt = [
"-O4",
"--enable-simd",
"--enable-reference-types",
"--enable-bulk-memory",
"--enable-mutable-globals",
"--enable-nontrapping-float-to-int",
"--enable-sign-ext",
]