HG Hybrid AI

Hybrid on-device/cloud generative AI web app using Firebase AI Logic.

What it does

  • Initializes the on-device Gemini Nano model in Chrome after a user click.
  • Generates text from text and optional JPEG/PNG image input.
  • Uses PREFER_ON_DEVICE mode: on-device when available, cloud fallback otherwise.
  • Displays whether inference used on-device or cloud.

How it uses Firebase AI Logic

  • FirebaseApp + GoogleAIBackend
  • getGenerativeModel with InferenceMode.PREFER_ON_DEVICE
  • initializeDeviceModel after user interaction
  • generateContent for text and multimodal input
  • App Check enforced (debug token for local dev)

Tech stack

Vite, Firebase JS SDK, Firebase Hosting.

Run locally

npm install npm run dev

Hosted demo

https://hg-hybrid-ai-2026.web.app

Repository

https://github.com/hgreco85/hg-hybrid-ai

Challenges

On-device model availability depends on Chrome version/flags; cloud fallback ensures functionality. App Check debug token required for local testing.

Built With

Share this project:

Updates

Submission history