(image)
| 26 | |
| 27 | // Initialize the Image Classifier method with MobileNet |
| 28 | function 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 | } |