Created
September 5, 2019 09:00
-
-
Save NMZivkovic/3cb7668ec520ca07ded18180e0ea6316 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
const pred = await tf.tidy(() => { | |
// Convert the canvas pixels to | |
let image = this.getImage(canvasHtmlElement) | |
// Make and format the predications | |
const output = this.model.predict(image) as any; | |
let predictions = Array.from(output.dataSync()); | |
console.log(predictions); | |
// Write out the prediction. | |
for (let i = 0; i < predictions.length; i++) { | |
if (predictions[i] == "1") { | |
this.predicted = i.toString(); | |
} | |
} | |
if (this.predicted == "") { | |
this.predicted = ":("; | |
} | |
}); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment