MCPcopy Create free account
hub / github.com/Vishal-raj-1/Awesome-JavaScript-Projects / detectImage

Function detectImage

assets/js/ImageClassifier.js:28–38  ·  view source on GitHub ↗
(image)

Source from the content-addressed store, hash-verified

26
27// Initialize the Image Classifier method with MobileNet
28function detectImage(image) {
29 ml5
30 .imageClassifier("MobileNet")
31 .then((classifier) => classifier.classify(image))
32 .then((results) => {
33 spinner.style.display = "none";
34 resultBox.style.display = "flex";
35 result.innerText = results[0].label;
36 probability.innerText = results[0].confidence.toFixed(4);
37 });
38}

Callers 1

readImageFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected