CreateMonitor
Experimental:This is anexperimental technology
Check theBrowser compatibility table carefully before using this in production.
Secure context: This feature is available only insecure contexts (HTTPS), in some or allsupporting browsers.
TheCreateMonitor interface provides information on the progress of an AI model download or some fine-tuning data for the model.
It can be used via:
In this article
Events
Inherits events from its parent,EventTarget.
downloadprogressExperimentalFired when progress is made on the AI model download.
Examples
>BasicCreateMonitor usage
ACreateMonitor instance is used via themonitor property of an AI API'screate() method (Summarizer.create() is shown below). Themonitor property takes a callback function as a value, the argument of which is theCreateMonitor instance. You can then monitor download progress via the instance'sdownloadprogress 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
| Specification |
|---|
| Writing Assistance APIs> # createmonitor> |
Browser compatibility
See also
- Using the Summarizer API
- Web AI demos on chrome.dev.