Project 04, AI in the browser
AI Text Summarizer
Paste a long article and get key points, a short TL;DR or a headline. Chrome's built-in model does the work, and other browsers get a fast fallback.
- Runs on
- Chrome built-in AI or your CPU
- Model
- Gemini Nano or sentence ranking
- First download
- Handled by Chrome
- Your browser
- Checking
Summarize text
Checking for Chrome's built-in model
Your summary shows here.
0words in0words out0%shorter
Ready
How it works
- Check availabilityThe page calls Summarizer.availability() to see if Gemini Nano is ready, downloadable or missing.
- Create a summarizerIt creates one with your type, length and format, showing progress if Chrome needs to download the model.
- Fall back when neededWithout the API, sentences are scored by how many important words they share and the best ones are kept in order.
// Feature-detect, then check if the on-device model is ready
if ("Summarizer" in self) {
const state = await Summarizer.availability(); // "available", "downloadable", ...
const summarizer = await Summarizer.create({
type: "key-points", length: "medium", format: "markdown",
monitor(m) {
m.addEventListener("downloadprogress", (e) => console.log(e.loaded));
},
});
const summary = await summarizer.summarize(longText);
}