modelport_flutter 0.1.0 copy "modelport_flutter: ^0.1.0" to clipboard
modelport_flutter: ^0.1.0 copied to clipboard

Flutter setup for ModelPort: app cache folder, asset bundles, and device RAM for picking model variants.

modelport_flutter #

Flutter setup for ModelPort. One call configures the model cache, asset:// bundles, native image decoding, and device RAM.

Future<void> main() async {
  WidgetsFlutterBinding.ensureInitialized();
  await ModelPortFlutter.init(adapters: [OnnxAdapter()]);
  runApp(const MyApp());
}

What init does:

  • Cache folder. Models are kept in the app support folder under modelport/, verified once, and reused offline.
  • Native image decoding. JPEG and PNG are decoded by the Flutter engine instead of pure Dart. On the test phone a 1546x1213 JPEG went from 717 ms to 302 ms. EXIF orientation is applied, like Pillow does in Python. Pass nativeImageDecoding: false to opt out.
  • Assets. asset://assets/models/<name> bundles load from your app's assets and are copied into the cache.
  • Device RAM. Read with device_info_plus, so variants that need more memory than the device has are skipped.

This package re-exports package:modelport/modelport.dart, so one import is enough.

Engines #

Add the engines you need and pass them to init:

Package Engine
modelport_onnx ONNX Runtime
modelport_executorch PyTorch ExecuTorch
modelport_llamacpp llama.cpp for GGUF language models

See the documentation and the demo app.

License #

Apache-2.0

0
likes
160
points
--
downloads

Documentation

Documentation
API reference

Publisher

unverified uploader

Weekly Downloads

Flutter setup for ModelPort: app cache folder, asset bundles, and device RAM for picking model variants.

Homepage
Repository (GitHub)
View/report issues
Contributing

Topics

#ai #machine-learning #on-device #flutter

License

Apache-2.0 (license)

Dependencies

device_info_plus, flutter, http, modelport, path, path_provider

More

Packages that depend on modelport_flutter