// run the webcam image through the image model
async function predict() {
// predict can take in an image, video or canvas html element
const prediction = await model.predict(webcam.canvas);
for (let i = 0; i < maxPredictions; i++) {
//join class name and confidence of class
const classPrediction = prediction[i].className + ": " + prediction[i].probability.toFixed(2);
//put class in html
labelContainer.childNodes[i].innerHTML = classPrediction;
}
}
the link to the code is at:https://replit.com/@MichaelMarchin2/simpler-facial-recognition#script.js