Skip to content

Allow connect Flutter Web to using the local Gemini API of Chrome by making use of interoperability between *Dart* and *JavaScript*.

License

Notifications You must be signed in to change notification settings

yeikel16/chrome_ai_api

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

12 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

chrome_ai_api

License: MIT

Allow connect Flutter Web to using the local Gemini API of Chrome by making use of interoperability between Dart and JavaScript.

🚧🚩This package is proof of concept, it is not recommended to use it in a production environment and should only be used on the Web platform.

Tested on MacOs iOS Windows Android Linux
Work Yes * * * *

Install

Add the following lines to your project dependencies

chrome_ai_api:
    git: https://github.com/yeikel16/chrome_ai_api.git

Run flutter pub get

Quick Test

  1. Make sure than you have install Chrome Canary in you machine and complate every steps from Built-in AI Early Preview Program setup guide.

    The session status be one of the following:

    • "readily": the model is available on-device and so creating will happen quickly
    • "after-download": the model is not available on-device, but the device is capable, so creating the session will start the download process (which can take a while).
    • "no": the model is not available for this device.

    Since the Gemeni API currently has no way of knowing the download progress (issue #4) of the model, you will have to monitor your network activity. The model weighs around 1.37 GB.

  2. Run example: Option A: The easy wahy is copy the URL after run the example project into Chrome Canary version. The normal version of Chrome not work beacause the Gemini API is only aviable in Chrome Dev channel (or Canary channel). Option B: Compile the example and launch a web server (for example, python -m http.server 8000, or by using the dhttpd package), and open the /build/web directory and opem localhost:8000 in your Chrome Canary browser.

Usege

final chromeAiApi = ChromeAiApi();

You can see the full example here.


Bugs or Requests

If you want to report a problem or would like to add a new feature, feel free to open an issue on GitHub. Pull requests are also welcome.

About

Allow connect Flutter Web to using the local Gemini API of Chrome by making use of interoperability between *Dart* and *JavaScript*.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published