AI inference library that runs machine learning models in the browser. Run ONNX models directly from JavaScript using WebAssembly.
Deploy the runtime files and run your first inference in the browser.
The ailia JS library itself is published in the ailia-js repository. Clone the sample repository ailia-models-js and initialize its submodules to fetch the library (ailia.js, ailia_s.wasm, ailia_simd_s.wasm, etc.) along with it.
git clone https://github.com/ailia-ai/ailia-models-js.git
cd ailia-models-js
git submodule init
git submodule update
The SIMD or non-SIMD WebAssembly binary is selected automatically depending on the execution environment.
Library Sample repositorySince wasm files cannot be loaded via file://, start a local server and access it from your browser. Samples such as face detection (BlazeFace) and object detection (YOLOX) run directly in the browser.
python3 -m http.server 8080
# → open http://localhost:8080
To try it without any setup, the live sample site runs the demos directly in your browser.
Sample site Get Started tutorialailia JS runs the ailia inference engine on WebAssembly, enabling browser-native AI inference with no installation required.
Edge AI in the browser. Inference runs entirely on the client, without sending data to a server.
A minimal sample that loads an ONNX model and runs inference with preprocessing and postprocessing callbacks.
import {Ailia} from './ailia.js';
// Initialize the module (SIMD support is detected automatically)
await Ailia.initialize();
// Create an instance and load the model and weights
const ailia = new Ailia();
ailia.loadModelAndWeights(modelFileContents, weightsFileContents);
// Define preprocessing and postprocessing callbacks
const preprocess = (inputBuffers) => {
inputBuffers.byIndex[0].buffer.Float32.set(inputData);
};
const postprocess = (outputBuffers) => {
return Array.from(outputBuffers.byIndex[0].buffer.Float32);
};
// Run inference with the input shapes
const result = ailia.run(preprocess, postprocess, [[1, 1, width, height]]);
// Call the destructor when done
ailia.destroy();
Frequently asked questions about ailia JS.
The library itself can be downloaded from the ailia-js repository. For the samples, clone ailia-models-js and run git submodule init and git submodule update to fetch the library along with them.
Yes. Two binaries are bundled — a SIMD build (ailia_simd_s.wasm) and a non-SIMD build (ailia_s.wasm) — and the best one is selected automatically for the execution environment. With SIMD enabled, BlazeFace inference time drops from 21ms to 8ms (measured on M2 Mac / Chrome).
Browsers on Windows, macOS, and Android support SIMD. iOS also supports WebAssembly SIMD since iOS 16.4 (Safari 16.4). On earlier iOS versions the non-SIMD build is used automatically.
Models in the ONNX format are supported. Load the model definition file (.onnx.prototxt) and the weights file (.onnx) with loadModelAndWeights(). ailia-models-js ships with sample models such as BlazeFace, BlazeHand, and YOLOX, and models published in ailia-models can also be used.
No. All inference runs inside the browser (WebAssembly), so input data is never sent to a server. This makes ailia JS a good fit for privacy-sensitive use cases such as background removal for video chat and microphone noise reduction.
Yes. ailia JS is provided as an ES6 module, but it can also be adapted for old-style JavaScript.
The evaluation license can be used for development and evaluation. For commercial distribution, please apply for a commercial license. See the ailia license terms for details.
Articles from the ailia Tech Blog.