xxxxxxxxxx
28
let video;
let classifier;
function preload(){
classifier=ml5.imageClassifier('https://teachablemachine.withgoogle.com/models/A-6qjWapZ/'+'model.json');
}
function setup() {
createCanvas(400, 400);
video=createCapture(VIDEO);
video.hide();
background(221);
classifyVideo();
}
function classifyVideo(){
classifier.classify(video,gotResults);
}
function gotResults(error,results){
if (error){
console.error(error);
}
else {
console.log(results);
}
}
function draw() {
background(221);
image(video,0,0);
}