Settings

Theme

Show HN: Code to run Gemini (Nano) locally on desktop/Chrome

github.com

22 points by notnotrishi · 5 comments · 1 min read

Reader

Chrome Canary (nightly build for devs) now has Gemini LLM inbuilt. This is just some simple code/demo to enable and use that feature.

2 threads
samspenc

Huh, looking at the code, it's simpler than I thought, basically these are the 2 lines that enable the request-response functionality:

  const session = await window.ai.createTextSession();
  const response = await session.prompt(prompt);
  • notnotrishiOP

    exactly! also, one can set parameters etc. if they'd like.

    also, after this post, i was able to do some tinkering and run it outside chrome, which i think would be more useful. hope they release the weights and make it open

DownrightNifty

Instructions didn't work for me. Tried on Windows 10 and macOS 14.3 (x86) with Chrome Canary. The "On Device Model" component doesn't show up.

Keyboard Shortcuts

j
Next item
k
Previous item
o / Enter
Open selected item
?
Show this help
Esc
Close modal / clear selection