flutter-ml / google_ml_kit_flutter

A flutter plugin that implements Google's standalone ML Kit
MIT License
907 stars 709 forks source link

[Text Recognition] TextRecognizer fails detect if a given TextRecognitionScript isn't ready #631

Closed njovy closed 1 month ago

njovy commented 1 month ago

There's no way to check if TextRecognizer has a given TextRecognitionScript. It would be great if we could check before processing an image, rather than relying on exceptions.

Is there a way to remove a downloaded TextRecognitionScript?

fbernaly commented 1 month ago

https://github.com/flutter-ml/google_ml_kit_flutter/blob/develop/packages/google_mlkit_commons/lib/src/model_manager.dart#L39-L45

njovy commented 1 month ago

@fbernaly Thank you for the rapid response. OnDeviceTranslator or some other packages have a method to check if the translation model is downloaded. I don't see that code in TextRecognizer.java, how do I use ModelManager to manage language models? The translation plugin doesn't fail to translate. It starts to download, then translates. However, I don't see that behavior in text recognition.

fbernaly commented 1 month ago

TextRecognition does not require model managing, because model is already included in the API. On Device Translation does require model managing.