-
Notifications
You must be signed in to change notification settings - Fork 0
/
index.html
47 lines (33 loc) · 1.54 KB
/
index.html
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>TensorFlow.js Tutorial</title>
<!-- Import TensorFlow.js -->
<script src="https://cdn.jsdelivr.net/npm/@tensorflow/[email protected]/dist/tf.min.js"></script>
<!-- Import tfjs-vis -->
<script src="https://cdn.jsdelivr.net/npm/@tensorflow/[email protected]/dist/tfjs-vis.umd.min.js"></script>
<!-- Import the data f
ile -->
<script src="data.js" type="module"></script>
<!-- Import the main script file -->
<script src="script.js" type="module"></script>
<link href="style.css" rel="stylesheet">
</head>
<body>
<h2>MNIST Tensorflow JS example</h2>
<div width="100%"><canvas id="drawCanvas" width="560" height="560"></canvas></div>
<button id="trainButton" type="button" onclick="click()">Train the model </button>
<button id="inferenceButton" type="button" onclick="click()">Perform inference</button>
<button id="clearButton" type="button" onclick="clear()">Clear the canvas</button>
<h2 id="prediction">The predicted digit is : </h2>
<script type="module">
import { inference, train, clear } from './script.js';
document.getElementById("trainButton").addEventListener("click", train);
document.getElementById("inferenceButton").addEventListener("click", inference);
document.getElementById("clearButton").addEventListener("click", clear);
</script>
</body>
</html>