-
Notifications
You must be signed in to change notification settings - Fork 2
Expand file tree
/
Copy pathindex.html
More file actions
256 lines (226 loc) · 11.5 KB
/
index.html
File metadata and controls
256 lines (226 loc) · 11.5 KB
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
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
<!DOCTYPE html>
<html lang="en">
<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>HandTracker</title>
<script src="https://cdn.jsdelivr.net/npm/p5@1.11.11/lib/p5.min.js"></script>
<script src="https://unpkg.com/ml5@1/dist/ml5.min.js"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/jszip/3.10.1/jszip.min.js"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/FileSaver.js/2.0.5/FileSaver.min.js"></script>
<script src="https://cdn.tailwindcss.com"></script>
<style>
/* Hide scrollbars but allow functional scrolling where needed */
* {
-ms-overflow-style: none;
scrollbar-width: none;
}
*::-webkit-scrollbar {
display: none;
}
body,
html {
margin: 0;
padding: 0;
background-color: #0f172a;
color: white;
height: 100vh;
width: 100vw;
overflow: hidden;
position: fixed;
}
#loader {
position: fixed;
inset: 0;
background: #0f172a;
z-index: 1000;
display: flex;
flex-direction: column;
align-items: center;
justify-content: center;
transition: opacity 0.5s ease-in-out;
}
.spinner {
width: 60px;
height: 60px;
border: 6px solid #1e293b;
border-bottom-color: #6366f1;
border-radius: 50%;
display: inline-block;
animation: rotation 1s linear infinite;
}
@keyframes rotation {
0% {
transform: rotate(0deg);
}
100% {
transform: rotate(360deg);
}
}
canvas {
max-width: 100% !important;
max-height: 100% !important;
object-fit: contain;
border-radius: 16px;
box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.7);
}
/* Responsive Layout Container */
.app-container {
display: flex;
height: 100vh;
width: 100vw;
}
@media (max-width: 1023px) {
.app-container {
flex-direction: column-reverse;
}
/* Controls at bottom for mobile reach */
aside {
height: 50%;
border-right: none !important;
border-top: 1px solid #1e293b;
overflow-y: auto;
}
main {
height: 50%;
}
}
.modal-active {
display: flex !important;
animation: fadeIn 0.2s ease-out;
}
@keyframes fadeIn {
from {
opacity: 0;
transform: scale(0.95);
}
to {
opacity: 1;
transform: scale(1);
}
}
</style>
</head>
<body class="font-sans">
<div id="loader">
<div class="spinner"></div>
<p class="mt-4 text-indigo-400 font-bold uppercase tracking-widest text-sm">Initializing Neural Engine</p>
</div>
<div id="custom-modal"
class="fixed inset-0 z-[110] hidden items-center justify-center p-4 bg-slate-950/90 backdrop-blur-sm">
<div class="bg-slate-900 border border-slate-700 w-full max-w-sm rounded-2xl p-6 shadow-2xl">
<h3 id="modal-title" class="text-xl font-bold text-white mb-2">Alert</h3>
<p id="modal-body" class="text-slate-400 text-md mb-6"></p>
<div id="modal-actions" class="flex gap-3 justify-end">
<button id="modal-cancel"
class="px-6 py-2 rounded-lg text-sm font-semibold text-slate-400 hover:bg-slate-800 transition">Cancel</button>
<button id="modal-confirm"
class="px-6 py-2 rounded-lg text-sm font-semibold bg-indigo-600 hover:bg-indigo-500 text-white transition">Confirm</button>
</div>
</div>
</div>
<div class="app-container">
<aside
class="w-full lg:w-96 bg-slate-900/80 p-6 lg:p-8 border-r border-slate-800 flex flex-col justify-between shrink-0">
<div class="space-y-6">
<div>
<h1 class="text-2xl font-black text-indigo-400 tracking-tighter">HandTracker</h1>
<p class="text-slate-500 text-xs uppercase font-bold tracking-widest">Mobile & Web Training</p>
</div>
<div class="space-y-5">
<section>
<label class="text-xs font-bold uppercase text-slate-500 block mb-2">1. Define Classes</label>
<div class="flex gap-2">
<input type="text" id="class-input" placeholder="e.g. Wave"
class="bg-slate-800 border border-slate-700 rounded-xl px-4 py-2.5 text-lg w-full outline-none focus:ring-2 focus:ring-indigo-500 text-white transition">
<button id="add-class-btn"
class="bg-indigo-600 hover:bg-indigo-500 px-5 py-2.5 rounded-xl font-bold text-lg">Add</button>
</div>
<div id="class-list" class="mt-3 flex flex-wrap gap-2"></div>
</section>
<section class="bg-slate-800/40 p-4 rounded-2xl border border-slate-700/50">
<div class="flex justify-between items-center mb-3">
<label class="text-xs font-bold uppercase text-slate-500">2. Collection</label>
<div class="flex items-center gap-2">
<span class="text-[10px] text-slate-400">Samples:</span>
<input type="number" id="max-data-input" value="80"
class="w-16 bg-slate-900 border border-slate-700 rounded-lg py-1 text-center text-sm font-bold text-indigo-400">
</div>
</div>
<div id="status-display"
class="text-sm text-slate-300 mb-4 bg-slate-950/50 p-3 rounded-xl border border-slate-800/50 italic">
Ready to collect...</div>
<button id="collect-btn"
class="w-full bg-emerald-600 hover:bg-emerald-500 disabled:opacity-20 py-3.5 rounded-xl font-bold text-lg transition shadow-lg shadow-emerald-900/20"
disabled>Start Capture</button>
</section>
<section class="bg-slate-800/40 p-4 rounded-2xl border border-slate-700/50">
<label class="text-xs font-bold uppercase text-slate-500 block mb-3">3. Training
Parameters</label>
<div class="grid grid-cols-3 gap-3 mb-4">
<div class="flex flex-col gap-1">
<span class="text-[10px] text-slate-500 font-bold text-center">Epochs</span>
<input type="number" id="epochs-input" value="50"
class="bg-slate-900 border border-slate-700 rounded-xl p-2 text-center text-md font-bold text-white">
</div>
<div class="flex flex-col gap-1">
<span class="text-[10px] text-slate-500 font-bold text-center">Batch</span>
<input type="number" id="batch-input" value="32"
class="bg-slate-900 border border-slate-700 rounded-xl p-2 text-center text-md font-bold text-white">
</div>
<div class="flex flex-col gap-1">
<span class="text-[10px] text-slate-500 font-bold text-center">Rate</span>
<input type="number" id="lr-input" value="0.01" step="0.001"
class="bg-slate-900 border border-slate-700 rounded-xl p-2 text-center text-md font-bold text-white">
</div>
</div>
<button id="train-btn"
class="w-full border-2 border-indigo-500 text-indigo-400 hover:bg-indigo-500 hover:text-white disabled:opacity-20 py-3 rounded-xl font-bold text-lg transition"
disabled>Begin Training</button>
</section>
</div>
</div>
<div class="space-y-3 mt-6">
<div id="export-section" class="hidden">
<button id="save-btn"
class="w-full bg-white text-slate-900 py-3 rounded-xl font-black text-sm uppercase tracking-wider transition hover:bg-indigo-50">Download
Weights (.ZIP)</button>
</div>
<button id="reset-btn"
class="w-full text-slate-600 hover:text-red-400 text-xs font-bold transition uppercase tracking-widest">System
Reset</button>
</div>
</aside>
<main class="flex-1 flex items-center justify-center p-4 bg-slate-950 relative">
<div id="canvas-container" class="relative w-full h-full flex items-center justify-center">
<div id="result-overlay" class="absolute top-4 left-4 z-20 hidden">
<div
class="bg-indigo-600/20 backdrop-blur-xl px-5 py-3 rounded-2xl border border-white/10 shadow-2xl ring-1 ring-white/20">
<div class="flex items-center gap-2 mb-1">
<div class="w-2 h-2 rounded-full bg-emerald-400 animate-pulse"></div>
<span
class="text-[10px] uppercase font-black tracking-widest text-indigo-200">Prediction</span>
</div>
<span id="res-label"
class="font-black text-2xl lg:text-3xl text-white uppercase leading-tight block">---</span>
<div class="flex items-center gap-2 mt-1">
<div class="flex-1 w-24 h-1 bg-white/10 rounded-full overflow-hidden">
<div id="conf-bar" class="h-full bg-indigo-400 transition-all duration-300"
style="width: 0%"></div>
</div>
<span id="res-conf" class="text-indigo-300 text-xs font-bold">0%</span>
</div>
</div>
</div>
<div id="recording-overlay"
class="absolute top-4 right-4 z-20 hidden items-center gap-3 bg-red-600 px-4 py-2 rounded-2xl text-xs font-black uppercase shadow-2xl animate-pulse">
<div class="w-2 h-2 bg-white rounded-full"></div>
<span id="target-label" class="tracking-widest">Capturing</span>
</div>
</div>
</main>
</div>
<script src="sketch.js"></script>
</body>
</html>