I tried out the Built-in AI that apparently works on Chrome Dev or Canary v127+.
https://developer.chrome.com/docs/ai/built-in
// Detect dark theme
var iframe = document.getElementById(‘tweet-1807976909847818477-157’);
if (document.body.className.includes(‘dark-theme’)) {
iframe.src = “https://platform.twitter.com/embed/Tweet.html?id=1807976909847818477&theme=dark”
}
Enable the flag
chrome://flags/
Prompt API for Gemini Nano: enable
Enables optimization guide on device: enable BypassPrefRequirements
Download the model
chrome://components/
After enabling the above flags and restarting the browser, you can access the components and download the model.
The model download itself takes a bit of time. (It took about 1-2 minutes for me.)
Try it from the console.
const ts = ai.createTextSession()
const gemi = await ts
const output = gemi.prompt(‘can you tell me the capital of Japan?‘)
output