Jarbas's picture
WakeHuBERT wake-word demo: score the ready models in the browser
adcaa8e verified
Raw History Blame Contribute Delete
5.51 kB
:root {
color-scheme: light;
--bg: #f4f4f2;
--surface: #fcfcfb;
--border: #dcdbd6;
--text: #0b0b0b;
--text-2: #52514e;
--muted: #6b6a66;
--accent: #1f62b5;
--accent-ink: #ffffff;
--series-1: #2a78d6;
--thr: #52514e;
--det: #c4371f;
--grid: #e6e5e1;
--hit-bg: #fdecea;
--focus: #1f62b5;
}
@media (prefers-color-scheme: dark) {
:root:not([data-theme="light"]) {
color-scheme: dark;
--bg: #121211;
--surface: #1a1a19;
--border: #34332f;
--text: #ffffff;
--text-2: #c3c2b7;
--muted: #a3a29a;
--accent: #5b9cf0;
--accent-ink: #0b0b0b;
--series-1: #3987e5;
--thr: #c3c2b7;
--det: #ff7a66;
--grid: #2a2a28;
--hit-bg: #3a1d18;
--focus: #8bbcff;
}
}
:root[data-theme="dark"] {
color-scheme: dark;
--bg: #121211;
--surface: #1a1a19;
--border: #34332f;
--text: #ffffff;
--text-2: #c3c2b7;
--muted: #a3a29a;
--accent: #5b9cf0;
--accent-ink: #0b0b0b;
--series-1: #3987e5;
--thr: #c3c2b7;
--det: #ff7a66;
--grid: #2a2a28;
--hit-bg: #3a1d18;
--focus: #8bbcff;
}
* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
margin: 0;
background: var(--bg);
color: var(--text);
font: 16px/1.5 system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
}
.wrap { max-width: 860px; margin: 0 auto; padding: 0 16px; }
.top { padding: 20px 0 4px; }
.top-row { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
h1 { font-size: 1.45rem; margin: 0; line-height: 1.2; }
h2 { font-size: 1.05rem; margin: 0 0 10px; }
.lede { color: var(--text-2); margin-top: 8px; }
.card {
background: var(--surface);
border: 1px solid var(--border);
border-radius: 10px;
padding: 16px;
margin: 12px 0;
min-width: 0;
}
a { color: var(--accent); }
.field-label { display: block; font-size: 0.85rem; color: var(--text-2); margin-bottom: 4px; }
.note { color: var(--text-2); font-size: 0.9rem; margin: 8px 0 0; }
.muted { color: var(--muted); font-size: 0.85rem; }
select, button, .button {
font: inherit;
color: var(--text);
background: var(--surface);
border: 1px solid var(--border);
border-radius: 8px;
min-height: 44px;
padding: 8px 14px;
}
select { width: 100%; max-width: 100%; }
button, .button { cursor: pointer; display: inline-flex; align-items: center; justify-content: center; }
button.primary { background: var(--accent); color: var(--accent-ink); border-color: var(--accent); font-weight: 600; }
button.primary[aria-pressed="true"] { background: var(--det); border-color: var(--det); color: #fff; }
button.ghost { background: transparent; }
button:disabled { opacity: 0.55; cursor: not-allowed; }
:focus-visible { outline: 3px solid var(--focus); outline-offset: 2px; }
.button:focus-within { outline: 3px solid var(--focus); outline-offset: 2px; }
.visually-hidden {
position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px;
overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0;
}
.facts { display: grid; grid-template-columns: 1fr 1fr; gap: 8px 16px; margin: 14px 0 0; }
.facts div { min-width: 0; }
.facts dt { font-size: 0.8rem; color: var(--text-2); }
.facts dd { margin: 0; font-weight: 600; overflow-wrap: anywhere; }
.facts .wide { grid-column: 1 / -1; }
.facts .wide dd { font-weight: 400; }
.thr-row { display: flex; align-items: center; gap: 12px; }
.thr-row input { flex: 1; min-width: 0; height: 44px; accent-color: var(--accent); }
.thr-row output { font-variant-numeric: tabular-nums; font-weight: 600; min-width: 3.5em; text-align: right; }
.inputs { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; align-items: end; }
.inputs .example { grid-column: 1 / -1; }
.example-row { display: flex; gap: 8px; }
.example-row select { flex: 1; min-width: 0; }
.level { margin-top: 12px; }
.meter { height: 10px; background: var(--grid); border-radius: 5px; overflow: hidden; }
#level-bar { height: 100%; width: 0; background: var(--series-1); transition: width 80ms linear; }
audio { width: 100%; margin-top: 12px; }
.plot-head { display: flex; justify-content: space-between; align-items: baseline; gap: 8px; flex-wrap: wrap; }
.plot-head h2 { margin: 0; }
.legend { display: flex; flex-wrap: wrap; gap: 14px; font-size: 0.85rem; color: var(--text-2); margin: 8px 0; }
.sw { display: inline-block; width: 16px; height: 0; vertical-align: middle; margin-right: 6px; }
.sw-score { border-top: 2px solid var(--series-1); }
.sw-thr { border-top: 2px dashed var(--thr); }
.sw-det { width: 10px; height: 10px; border-radius: 50%; background: var(--det); }
.plot-box { position: relative; }
canvas { display: block; width: 100%; height: 220px; touch-action: pan-y; }
.tip {
position: absolute; top: 4px; pointer-events: none;
background: var(--surface); border: 1px solid var(--border); border-radius: 6px;
padding: 3px 8px; font-size: 0.8rem; font-variant-numeric: tabular-nums; white-space: nowrap;
}
.status { margin: 10px 0 0; color: var(--text-2); }
.status.error { color: var(--det); font-weight: 600; }
.detections { margin: 6px 0 0; font-weight: 600; min-height: 1.5em; }
.detections.hit { background: var(--hit-bg); border-radius: 6px; padding: 4px 8px; }
.about p { margin: 0 0 10px; }
.foot { color: var(--muted); font-size: 0.85rem; padding-bottom: 24px; }
@media (min-width: 640px) {
.facts { grid-template-columns: repeat(4, 1fr); }
.inputs { grid-template-columns: auto auto 1fr; }
.inputs .example { grid-column: auto; }
canvas { height: 260px; }
}