mirror of
https://github.com/GoogleChrome/chrome-extensions-samples.git
synced 2026-03-26 13:19:49 +07:00
* Migrate to latest version of the language model * Update readme to better describe the sample. * More readme updates * Consistent API naming and format lists
1.3 KiB
1.3 KiB
Alt Texter: Generate accessible image descriptions with Chrome's built-in Prompt API
This sample demonstrates how to use Chrome's built-in AI APIs to generate alt text for images, making web content more accessible. It combines two on-device AI capabilities:
- Prompt API with multimodal input (Gemini Nano) for image understanding
- Translator API for translating descriptions into multiple languages
Overview
Alt Texter adds a context menu entry for images on the web. When activated, it:
- Analyzes the image using Gemini Nano's multimodal capabilities.
- Generates a concise, functional description following accessibility best practices (object-action-context framework).
- Displays the description in a popup where you can optionally translate it.
- Lets you copy the alt text to your clipboard for use elsewhere.
Running this extension
- Clone this repository.
- Load this directory in Chrome as an unpacked extension.
- Right-click an image on a webpage and select "Generate alt text".
- Wait for the description to be generated, then optionally translate it or copy it to your clipboard.