forked from webmachinelearning/webnn-samples
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathindex.html
136 lines (136 loc) · 5.75 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
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
<html>
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1, shrink-to-fit=no">
<title>WebNN LeNet Example</title>
<link rel="stylesheet" href="https://stackpath.bootstrapcdn.com/bootstrap/4.5.2/css/bootstrap.min.css" integrity="sha384-JcKb8q3iqJ61gNV9KGb8thSsNjpSL0n8PARn9HuZOnIxN0hoP+VmmDGMN5t9UJ0Z" crossorigin="anonymous">
<link rel="stylesheet" href="../common/css/style.css">
<link rel="icon" type="image/x-icon" href="../common/img/favicon/favicon.ico">
<link rel="apple-touch-icon" sizes="180x180" href="../common/img/favicon/apple-touch-icon.png">
<link rel="icon" type="image/png" sizes="32x32" href="../common/img/favicon/favicon-32x32.png">
<link rel="icon" type="image/png" sizes="16x16" href="../common/img/favicon/favicon-16x16.png">
<link rel="manifest" href="../common/img/favicon/site.webmanifest">
</head>
<body>
<nav class="navbar navbar-expand-md navbar-dark">
<a href="../index.html">
<div class="logosvg" id="logosvg"></div>
</a>
<span class="navbar-brand">Handwritten Digits Classification</span>
<ul class="navbar-nav"></ul>
</nav>
<div class="container" id="container">
<div class="row align-items-center mt-3 mb-3">
<div class="col-md">
</div>
<div class="col-md-9">
<div class="card">
<div class="card-body">
<div class="btn-group-toggle" data-toggle="buttons" id="backendBtns">
<span class='mr-3'>Backend</span>
<label class="btn btn-outline-info" name="polyfill">
<input type="radio" name="backend" id="polyfill_cpu" autocomplete="off">Wasm (CPU)
</label>
<label class="btn btn-outline-info" name="polyfill">
<input type="radio" name="backend" id="polyfill_gpu" autocomplete="off">WebGL (GPU)
</label>
<label class="btn btn-outline-info" name="webnn">
<input type="radio" name="backend" id="webnn_cpu" autocomplete="off">WebNN (CPU)
</label>
<label class="btn btn-outline-info" name="webnn">
<input type="radio" name="backend" id="webnn_gpu" autocomplete="off">WebNN (GPU)
</label>
</div>
</div>
</div>
</div>
<div class="col-md">
</div>
</div>
<div class="row">
<div class="col-md">
</div>
<div class="col-md-4">
<canvas id="visual_canvas" width=280 height=280></canvas>
</div>
<div class="col-md-5">
<div>
<h5>Prediction Result:</h5>
</div>
<div>
<table class='table table-sm'>
<thead>
<tr>
<th scope='col'>#</th>
<th scope='col'>Label</th>
<th scope='col'>Probability</th>
</tr>
</thead>
<tbody>
<tr>
<th scope='row'>1</th>
<td id='label0'></td>
<td id='prob0'></td>
</tr>
<tr>
<th scope='row'>2</th>
<td id='label1'></td>
<td id='prob1'></td>
</tr>
<tr>
<th scope='row'>3</th>
<td id='label2'></td>
<td id='prob2'></td>
</tr>
</tbody>
</table>
</div>
<div>
<div id='buildTime'></div>
</div>
<div>
<div id='inferenceTime'></div>
</div>
</div>
<div class="col-md">
</div>
</div>
<div class="row mt-4">
<div class="col-md">
</div>
<div class="col-md-5">
<button type="button" class="btn btn-info btn-lg mr-2" id="next">Next</button>
<button type="button" class="btn btn-info btn-lg mr-2" id="clear">Clear</button>
<button type="button" class="btn btn-info btn-lg" id="predict" disabled>Predict</button>
</div>
<div class="col-md-4"></div>
<div class="col-md">
</div>
</div>
</div>
<footer class="text-muted text-center text-small mt-5">
<div id="badge"></div>
<p>©2023 <a href="https://webmachinelearning.github.io/">WebNN API</a></p>
</footer>
<script>
// This workaround is to fix jquery loading issue in electron.
// Refer to https://stackoverflow.com/questions/32621988/electron-jquery-is-not-defined.
if (typeof module === "object") {
window.tempModule = module;
module = undefined;
}
</script>
<script src="https://code.jquery.com/jquery-3.5.1.slim.min.js" integrity="sha384-DfXdz2htPH0lsSSs5nCTpuj/zy4C+OGpamoFVy38MVBnE+IbbVYUew+OrCXaRkfj" crossorigin="anonymous"></script>
<script src="https://cdn.jsdelivr.net/npm/[email protected]/dist/umd/popper.min.js" integrity="sha384-9/reFTGAW83EW2RDu2S0VKaIzap3H66lZH81PoYlFhbGU+6BZp6G7niu735Sk7lN" crossorigin="anonymous"></script>
<script src="https://stackpath.bootstrapcdn.com/bootstrap/4.5.2/js/bootstrap.min.js" integrity="sha384-B4gt1jrGC7Jh4AgTPSdUtOBvfO8shuf57BaghqFfPlYxofvL8/KUEfYiJOMMV+rV" crossorigin="anonymous"></script>
<script src="libs/mnist.js"></script>
<script>
// To restore module after loading 3rd-party libraries.
if (window.tempModule) module = window.tempModule;
</script>
<script type="module" src="main.js"></script>
<script type="module" src="../common/component/component.js"></script>
<script async src="https://www.googletagmanager.com/gtag/js?id=G-6TK7JD3KKY"></script>
<script src="../common/libs/gtag.js"></script>
</body>
</html>