I am building a web app that will allow the user to draw an MNIST style digit in a 28*28 p5 canvas and uses a CNN that I built in python to classify the digit. I have a function that takes the canvas and turns it into a 2d array of floats.
function savedigit() {
vals = create2DArray(w, w); //function to create a 2d array with rows and columns
for (let i = 0; i < w; i++) {
for (let j = 0; j < w; j++) {
let p = Pixels[i][j];
vals[i][j]=(round((1-p.value)*100));
}
}
reset(); //resets the canvas
return vals
}
I want to send that 2D array that is generated to the flask app so the CNN can classify it. I have no idea how to do this because im a beginner to flask and i couldn't find any help for this on google. the program for drawing on the canvas and generating the array is found here