Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
async function run() {
const model = await automl.loadImageClassification(MODEL_URL);
const image = document.getElementById('daisy');
const predictions = await model.classify(image);
// Show the resulting object on the page.
const pre = document.createElement('pre');
pre.textContent = JSON.stringify(predictions, null, 2);
document.body.append(pre);
}
async function run() {
const model = await automl.loadObjectDetection(MODEL_URL);
const image = document.getElementById('salad');
// These are the default options.
const options = {score: 0.5, iou: 0.5, topk: 20};
const predictions = await model.detect(image, options);
// Show the resulting object on the page.
const pre = document.createElement('pre');
pre.textContent = JSON.stringify(predictions, null, 2);
document.body.append(pre);
drawBoxes(predictions);
}