google_mlkit_genai_image_description 0.2.0 copy "google_mlkit_genai_image_description: ^0.2.0" to clipboard
google_mlkit_genai_image_description: ^0.2.0 copied to clipboard

A Flutter plugin to use Google's ML Kit GenAI Image Description API to generate descriptions of images.

Google's ML Kit GenAI Image Description for Flutter #

Pub Version analysis Star on Github License: MIT

A Flutter plugin to use Google's ML Kit GenAI Image Description API to generate descriptions for images.

PLEASE READ THIS before continuing or posting a new issue:

  • Google's ML Kit was build only for mobile platforms: iOS and Android apps. Web or any other platform is not supported, you can request support for those platform to Google in their repo.

  • This plugin is not sponsored or maintained by Google. The authors are developers excited about Machine Learning that wanted to expose Google's native APIs to Flutter.

  • Google's ML Kit APIs are only developed natively for iOS and Android. This plugin uses Flutter Platform Channels as explained here.

Requirements #

Android #

  • minSdkVersion: 26
  • targetSdkVersion: 35
  • compileSdkVersion: 35

⚠️ Important: This API is built on top of AICore and will not support all Android devices. It requires devices with AICore support. Please check device compatibility before using this feature in production.

⚠️ Production Disclaimer: Using this plugin in production is the responsibility of the developers consuming the plugin, not the authors. The authors provide this plugin as-is and are not responsible for any issues, failures, or compatibility problems that may arise from using this plugin in production environments.

Note: This API is currently only available on Android. iOS support may be added in the future.

Usage #

Image Description #

Create an instance of ImageDescriber

final imageDescriber = ImageDescriber();

Check feature status

final status = await imageDescriber.checkFeatureStatus();
if (status == FeatureStatus.downloadable) {
  await imageDescriber.downloadFeature(
    onDownloadCompleted: () {
      // Start image description
    },
  );
} else if (status == FeatureStatus.available) {
  // Start image description
}

Process image

final imageData = {
  'type': 'file',
  'path': '/path/to/image.jpg',
};
final description = await imageDescriber.runInference(imageData);
print('Description: $description');

Release resources with close()

imageDescriber.close();

Example app #

Find the example app here.

Contributing #

Contributions are welcome. In case of any problems look at existing issues, if you cannot find anything related to your problem then open an issue. Create an issue before opening a pull request for non trivial fixes. In case of trivial fixes open a pull request directly.

0
likes
140
points
1.5k
downloads

Documentation

API reference

Publisher

verified publisherflutter-ml.dev

Weekly Downloads

A Flutter plugin to use Google's ML Kit GenAI Image Description API to generate descriptions of images.

Homepage
Repository (GitHub)
View/report issues

License

MIT (license)

Dependencies

flutter, google_mlkit_commons

More

Packages that depend on google_mlkit_genai_image_description

Packages that implement google_mlkit_genai_image_description