
Security News
Attackers Are Hunting High-Impact Node.js Maintainers in a Coordinated Social Engineering Campaign
Multiple high-impact npm maintainers confirm they have been targeted in the same social engineering campaign that compromised Axios.
tflite-helper
Advanced tools
A Simple Library That Helps You Run TFLite Models in the Browser.
Base code taken from https://github.com/Volcomix/virtual-background
$ npm install tflite-helper
To use this library you'll need to host all the files from the wasm/dist folder in the same path on your server.
ex. /tflite-helper
> tflite-helper.js
> tflite-helper.wasm
> tflite-helper-simd.js
> tflite-helper-simd.wasm
You'll also need to host your model's .tflite file.
import createModel from 'tflite-helper';
// model_path - The URL from which to load the .tflite model file - ex. /model.tflite
// module_path - The URL from which to load the emscipten module and wasm files - ex. /tflite-helper/
const model = await createModel(model_path, module_path);
// Model Input/Ouput:
// id: number
// type: number
// offset: number
// size: number
// dimensions: number[]
// data: TypedArray - raw data of input / output (readable/writeable)
// Note: data is a getter so make sure to cache it in loops
model.inputs; // Array of model inputs
model.outputs; // Array of model outputs
const input_data = model.inputs[0].data;
// Apply changes to input data
model.invoke(); // Commonly known as predict
const output_data = model.outputs[0].data;
// Read output data
model.free(); // Free the model \w all it's memory
You'll need at least some very basic Bazel experience to do this.
Sometimes TFLite models use Custom Operations. You'll need to find where that Custom Operation comes from, add it to the Docker Container using the Dockerfile or the WORKSPACE file, add it as a dependency to both binaries in the BUILD file and finally import it and register it in the loadModel function in the main.cpp file. You can see how to register it from the way this library registers the Convolution2DTransposeBias from MediaPipe.
You'll will also need to build the WASM files from scratch (see below).
If you don't want to use the files from wasm/dist, then you'll have to build them yourself.
You'll need to install Docker if you haven't done that already.
Change the docker-username in the build.sh or build.bat file in the wasm folder and run the script.
FAQs
A Simple Library That Helps You Run TFLite Models in the Browser.
We found that tflite-helper demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Security News
Multiple high-impact npm maintainers confirm they have been targeted in the same social engineering campaign that compromised Axios.

Security News
Axios compromise traced to social engineering, showing how attacks on maintainers can bypass controls and expose the broader software supply chain.

Security News
Node.js has paused its bug bounty program after funding ended, removing payouts for vulnerability reports but keeping its security process unchanged.