trash.drop(inputFileHandler('trash'))
bananas.drop(inputFileHandler('banana'))
trainButton.mouseClicked(trainButtonPressed)
console.log('Model Loaded!');
function inputFileHandler(label){return (file)=>{
if (file.type === 'image') {
let inputImage = createImg(file.data, '');
classifier.addImage(inputImage, label);
console.log('[Insert a rude comment about the input not being an image]');
function trainButtonPressed(){
classifier.train((lossValue) => {
console.log('Loss is', lossValue);
}else{featureExtractor.save()}
featureExtractor = ml5.featureExtractor('MobileNet', modelLoaded);
classifier=featureExtractor.classification()
createCanvas(windowWidth, windowHeight);
let boxWidth=windowWidth/3
let boxHeight=windowHeight/2
let boxXmarigin=windowWidth/12
let boxYmarigin=windowHeight/12
trash.position(boxXmarigin,boxYmarigin)
trash.size(boxWidth,boxHeight)
rect(boxXmarigin,boxYmarigin,boxWidth,boxHeight)
bananas.position(windowWidth/2+boxXmarigin,boxYmarigin)
bananas.size(boxWidth,boxHeight)
rect(windowWidth/2+boxXmarigin,boxYmarigin,boxWidth,boxHeight)
let trainButtonYcenter=windowHeight*3/4
trainButton.position(windowWidth/2-trainButtonWidth/2,trainButtonYcenter-trainButtonHeight/2)
trainButton.size(trainButtonWidth,trainButtonHeight)
rect(windowWidth/2-trainButtonWidth/2,trainButtonYcenter-trainButtonHeight/2,trainButtonWidth,trainButtonHeight)
textY=boxYmarigin+boxHeight/2
textAlign(CENTER, CENTER);
text('Train',windowWidth/2,trainButtonYcenter)
text('Feed me!\n',windowWidth*3/4,textY)
text('Trash for comparison\n',windowWidth/4,textY)
rect(windowWidth*3/4-100,textY+20,200,40)
rect(windowWidth/4-100,textY+20,200,40)
text(bananasFed,windowWidth*3/4,textY+40)
text(trashFed,windowWidth/4,textY+40)