xxxxxxxxxx
28
function setup() {
createCanvas(400, 400);
// see https://p5js.org/reference/#/p5/createFileInput
let fileInput = createFileInput(handleFile, true);
fileInput.position(0, 0);
}
function draw() {
background(220);
}
function handleFile(file) {
if (file.type !== 'image') {
console.log(file.name + ' is not an image, ignoring');
return;
}
console.log('Adding ' + file.name + '...');
// turn it into an image
let img = createImg(file.data, '');
img.hide();
// you should be able to add img to the Neural Network
// here, e.g.
//pixelBrain.addData(img, label);
}