web api interface
CreateMonitor
Limited availabilitySecure context
The CreateMonitor interface provides information on the progress of an AI model download or some fine-tuning data for the model.
It can be used via:
Events
Inherits events from its parent, EventTarget.
downloadprogressExperimental- : Fired when progress is made on the AI model download.
Examples
Basic CreateMonitor usage
A CreateMonitor instance is used via the monitor property of an AI API’s create() method (Summarizer.create() is shown below). The monitor property takes a callback function as a value, the argument of which is the CreateMonitor instance. You can then monitor download progress via the instance’s downloadprogress event.
const summarizer = await Summarizer.create({
sharedContext:
"A general summary to help a user decide if the text is worth reading",
monitor(monitor) {
monitor.addEventListener("downloadprogress", (e) => {
console.log(`download progress: ${e.loaded}/${e.total}`);
});
},
});
const summary = await summarizer.summarize(myText);
Specifications
SpecificationsStandards references are available on the canonical MDN page.
Browser compatibility
Browser compatibilityCompatibility data is available on the canonical MDN page.
See also
- Using the Summarizer API
- Web AI demos on chrome.dev.