Created
April 29, 2020 19:50
-
-
Save pepetox/e6add7017c87007db5af52e766213902 to your computer and use it in GitHub Desktop.
tensoflow.js html
This file contains 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
<script src="https://unpkg.com/@tensorflow/tfjs"></script> | |
<script src="https://unpkg.com/@tensorflow/tfjs-automl"></script> | |
<img id="daisy" crossorigin="anonymous" src="/hattori.jpeg"> | |
<script> | |
async function run() { | |
const model = await tf.automl.loadImageClassification('model.json'); | |
const image = document.getElementById('daisy'); | |
const predictions = await model.classify(image); | |
console.log(predictions); | |
// Show the resulting object on the page. | |
const pre = document.createElement('pre'); | |
pre.textContent = JSON.stringify(predictions, null, 2); | |
document.body.append(pre); | |
} | |
run(); | |
</script> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment