How to run Gemini Nano locally in your browser
Blog post from HuggingFace
Joshua Xenova's tutorial explores how to activate the Built-in AI feature in Google Chrome for running Gemini Nano using the experimental Prompt API, which enables web developers to access browser-provided language models for privacy-preserving on-device AI inference. To use this feature, users must upgrade to Chrome Dev or Canary version 127 or higher and enable specific experimental flags. The tutorial provides a step-by-step guide on verifying the setup and demonstrates basic and advanced usage of the Prompt API, including creating text sessions, using text generation models, and streaming text results. It also explains how to customize session parameters, handle control tokens for multi-round conversations, and integrate with Transformers.js for enhanced functionality. The guide underscores the potential of these tools to create interactive and dynamic AI-driven applications in-browser without compromising user privacy.