DenisovAV / flutter_gemma

The Flutter plugin allows running the Gemma AI model locally on a device from a Flutter application.
MIT License
55 stars 17 forks source link

Model Path parameter in initialization. #21

Closed Vinayak006 closed 1 month ago

Vinayak006 commented 1 month ago

The modelPath parameter should be moved to the init method, as the model doesn't need to be loaded from assets. Instead, the model can be downloaded during the first-time use, saved locally, and the saved path can be passed during initialization for future use.

This change ensures flexibility by allowing the model to be dynamically downloaded, stored locally, and reused without needing to rely on a static asset path.

DenisovAV commented 1 month ago

Yes, of course, load it once and then use it. I don't see the need for the path in init, especially since this will only work for Android. Load from assets method was added to simplify such loading, probably I need to explain it better in readme, not to confuse people

Vinayak006 commented 1 month ago

I can't see the latest release code. Is it keeping the loaded model locally for later use? If not, instead of loading the model from the network every time the application is closed and reopened, we could download the model from the server once and save it locally in the application's support or document directory. This way, we can use the local path for initialization in future app launches. Also, we can't keep the model in the assets due to the larger APK size, and loading it from assets isn't an option either

DenisovAV commented 1 month ago

You don't need to load the model every time, you can load it once and use. Opportunity with assets is not for production, for debug purposes only, so APK size is doesn't matter, you can't use it in release.

DenisovAV commented 1 month ago

I'll update an example to show you how to use it properly

Vinayak006 commented 1 month ago

I've seen the updated README and the example. They are clear and well-explained. :+1: