tflite_web 0.2.2 copy "tflite_web: ^0.2.2" to clipboard
tflite_web: ^0.2.2 copied to clipboard

Platformweb

Run Tensorflow Lite models using TFLite JS and WebAssembly on browser

TFLite Web #

Run TFLite models on Dart JS. It is packaged in a WebAssembly binary that runs in a browser

Getting Started #

  • Unpack tflite (link) into your web folder.
    Result structure:
    -- Web
    ├── tflite
    ──────├── tf-backend-cpu.js
    ──────├── tf-core.js
    ──────├── tf-tflite.min.js
    ──────├── tflite_web_...

  • Initialize TFLite:

await TFLiteWeb.initialize();

This may take a couple of seconds

  • Either Load Model from Url:
final loadedModel = await TFLiteModel.fromUrl(modelUrl);
  • Or load from memory:
final loadedModel = await TFLiteModel.fromMemory(modelBytes);
  • Create a tensor:
final input = createTensor(data, shape, dataType);
  • Run the model:
final outputs = loadedModel.predict(input);

Depending on the model, the input can be a Tensor, a list of Tensors, or a Tensor map

Current Version: #

  • TF-JS: 4.11.0
  • TF-JS TFLite: 0.0.1-alpha.10
13
likes
140
pub points
66%
popularity

Publisher

verified publisherappgozar.com

Run Tensorflow Lite models using TFLite JS and WebAssembly on browser

Repository (GitHub)
View/report issues

Documentation

API reference

License

Apache-2.0 (LICENSE)

Dependencies

js

More

Packages that depend on tflite_web