Spaces:
Running
Running
Sample button, LM weights 0.15/1 (tuned), visual polish
Browse filesFiles changed (2)
- app.js+3-2
- index.html+5-3
73 unmodified lines74757677787980117 unmodified lines19819920020120220320420520620720820921073 unmodified linesfunction requestCorrection(s, final) {if (!state.correct) { render(); return; }const a = Math.max(0, s.start - Math.round(0.25 * SR)), b = final ? Math.min(state.n, s.end + Math.round(0.25 * SR)) : state.n;const job = { type: 'correct', id: s.id, gen: ++s.gen, samples: state.audio.slice(a, b), upto: (b - a) / SR + a / SR, final, useLM: state.useLM, alpha: 0.2, beta: 1.5, beam: 4 };if (final) state.corrQueue.push(job); else if (!state.corrBusy) state.corrQueue.unshift(job);pumpCorr();}117 unmodified linesconst seg = { id: state.seq++, start: cuts[k], end: cuts[k + 1], toks: [], frames: [], corr: null, final: true, gen: 1, shown: [], file: true };state.segs.push(seg);const lo = Math.max(0, cuts[k] - 1600), hi = Math.min(x.length, cuts[k + 1] + 1600);state.corrQueue.push({ type: 'correct', id: seg.id, gen: 1, samples: x.slice(lo, hi), upto: hi / SR, final: true, useLM: state.useLM, alpha: 0.2, beta: 1.5, beam: 4 });}pumpCorr();}// ---------- UI wiring ----------$('#rec').onclick = () => { if (!document.body.classList.contains('ready')) return; state.mode === 'mic' ? stopMic() : startMic().catch(e => { state.mode = null; setStatus('⚠ ' + e.message, 'err'); }); };$('#file').onchange = e => { const f = e.target.files[0]; if (f) runFile(f).catch(err => setStatus('⚠ ' + err.message, 'err')); e.target.value = ''; };$('#clear').onclick = () => { if (state.mode !== 'mic') resetAll(); };$('#lm').onchange = e => { state.useLM = e.target.checked; };$('#fix').onchange = e => { state.correct = e.target.checked; render(); };73 unmodified lines74757677787980117 unmodified lines19819920020120220320420520620720820921021173 unmodified linesfunction requestCorrection(s, final) {if (!state.correct) { render(); return; }const a = Math.max(0, s.start - Math.round(0.25 * SR)), b = final ? Math.min(state.n, s.end + Math.round(0.25 * SR)) : state.n;const job = { type: 'correct', id: s.id, gen: ++s.gen, samples: state.audio.slice(a, b), upto: (b - a) / SR + a / SR, final, useLM: state.useLM, alpha: 0.15, beta: 1, beam: 4 };if (final) state.corrQueue.push(job); else if (!state.corrBusy) state.corrQueue.unshift(job);pumpCorr();}117 unmodified linesconst seg = { id: state.seq++, start: cuts[k], end: cuts[k + 1], toks: [], frames: [], corr: null, final: true, gen: 1, shown: [], file: true };state.segs.push(seg);const lo = Math.max(0, cuts[k] - 1600), hi = Math.min(x.length, cuts[k + 1] + 1600);state.corrQueue.push({ type: 'correct', id: seg.id, gen: 1, samples: x.slice(lo, hi), upto: hi / SR, final: true, useLM: state.useLM, alpha: 0.15, beta: 1, beam: 4 });}pumpCorr();}// ---------- UI wiring ----------$('#rec').onclick = () => { if (!document.body.classList.contains('ready')) return; state.mode === 'mic' ? stopMic() : startMic().catch(e => { state.mode = null; setStatus('⚠ ' + e.message, 'err'); }); };$('#file').onchange = e => { const f = e.target.files[0]; if (f) runFile(f).catch(err => setStatus('⚠ ' + err.message, 'err')); e.target.value = ''; };$('#sample').onclick = async () => { if (!document.body.classList.contains('ready') || state.mode) return; const b = await (await fetch('./samples/fleurs_fa_sample.wav')).blob(); runFile(new File([b], 'FLEURS fa · 6 sentences', { type: 'audio/wav' })).catch(err => setStatus('⚠ ' + err.message, 'err')); };$('#clear').onclick = () => { if (state.mode !== 'mic') resetAll(); };$('#lm').onchange = e => { state.useLM = e.target.checked; };$('#fix').onchange = e => { state.correct = e.target.checked; render(); };
10 unmodified lines1112131415161721 unmodified lines394041424344454638 unmodified lines85868788899010 unmodified lines*{box-sizing:border-box}html,body{margin:0;height:100%;background:var(--bg);color:var(--ink);font-family:Vazirmatn,Inter,system-ui,sans-serif;-webkit-font-smoothing:antialiased}body{display:flex;flex-direction:column;overflow:hidden}.aurora{position:fixed;inset:-20%;z-index:-1;filter:blur(90px);opacity:.55;pointer-events:none}.aurora i{position:absolute;border-radius:50%;animation:drift 22s ease-in-out infinite alternate}.aurora i:nth-child(1){width:46vw;height:46vw;background:#4338ca;top:5%;right:8%}.aurora i:nth-child(2){width:38vw;height:38vw;background:#0e7490;bottom:2%;left:10%;animation-delay:-7s}21 unmodified lines@keyframes pop{from{opacity:0;filter:blur(6px);transform:translateY(.15em)}}@keyframes fixflash{0%{color:var(--fix);text-shadow:0 0 .4em rgba(251,191,36,.7)}100%{color:var(--ink);text-shadow:none}}#loader{position:absolute;inset:auto 0 0 0;height:4px;background:rgba(255,255,255,.06);border-radius:0 0 28px 28px;overflow:hidden;transition:opacity .6s}#loader.done{opacity:0} #bar{height:100%;width:0;background:linear-gradient(90deg,#818cf8,#7dd3fc);transition:width .2s}#loadtxt{position:absolute;left:20px;bottom:12px;color:var(--dim);font:13px Inter;direction:ltr}.dock{display:flex;align-items:center;justify-content:center;gap:clamp(12px,3vw,28px);padding:22px 0 14px;flex-wrap:wrap}#rec{--s:clamp(84px,11vw,112px);width:var(--s);height:var(--s);border-radius:50%;border:0;cursor:pointer;position:relative;background:radial-gradient(circle at 35% 30%,#ff8aa0,var(--rec) 55%,#9f1239);box-shadow:0 12px 40px rgba(255,77,109,.35),inset 0 -6px 18px rgba(0,0,0,.25);transition:transform .15s,filter .3s}38 unmodified lines<div class="dock"><label class="btn" title="Upload audio"><svg viewBox="0 0 24 24"><path d="M5 20h14v-2H5v2zm7-16-5 5h3v6h4V9h3l-5-5z"/></svg>فایل<input id="file" type="file" accept="audio/*,video/*" hidden></label><button id="rec" aria-pressed="false" title="Record (Space)"><svg class="mic" viewBox="0 0 24 24"><path d="M12 14a3 3 0 0 0 3-3V5a3 3 0 0 0-6 0v6a3 3 0 0 0 3 3zm5-3a5 5 0 0 1-10 0H5a7 7 0 0 0 6 6.92V21h2v-3.08A7 7 0 0 0 19 11h-2z"/></svg><svg class="stop" viewBox="0 0 24 24"><rect x="6" y="6" width="12" height="12" rx="2"/></svg></button><button id="clear" class="btn" title="Clear"><svg viewBox="0 0 24 24"><path d="M6 19a2 2 0 0 0 2 2h8a2 2 0 0 0 2-2V7H6v12zM19 4h-3.5l-1-1h-5l-1 1H5v2h14V4z"/></svg>پاک</button><button id="copy" class="btn" title="Copy"><svg viewBox="0 0 24 24"><path d="M16 1H4a2 2 0 0 0-2 2v14h2V3h12V1zm3 4H8a2 2 0 0 0-2 2v14a2 2 0 0 0 2 2h11a2 2 0 0 0 2-2V7a2 2 0 0 0-2-2zm0 16H8V7h11v14z"/></svg>کپی</button><div class="toggles"><label><input id="fix" type="checkbox" checked>اصلاح با بافت کامل</label><label><input id="lm" type="checkbox" checked>مدل زبانی</label><span id="filename"></span></div>10 unmodified lines111213141516171821 unmodified lines404142434445464738 unmodified lines8687888990919210 unmodified lines*{box-sizing:border-box}html,body{margin:0;height:100%;background:var(--bg);color:var(--ink);font-family:Vazirmatn,Inter,system-ui,sans-serif;-webkit-font-smoothing:antialiased}body{display:flex;flex-direction:column;overflow:hidden}.aurora{position:fixed;inset:-20%;z-index:0;filter:blur(100px);opacity:.75;pointer-events:none}header,main,footer{position:relative;z-index:1}.aurora i{position:absolute;border-radius:50%;animation:drift 22s ease-in-out infinite alternate}.aurora i:nth-child(1){width:46vw;height:46vw;background:#4338ca;top:5%;right:8%}.aurora i:nth-child(2){width:38vw;height:38vw;background:#0e7490;bottom:2%;left:10%;animation-delay:-7s}21 unmodified lines@keyframes pop{from{opacity:0;filter:blur(6px);transform:translateY(.15em)}}@keyframes fixflash{0%{color:var(--fix);text-shadow:0 0 .4em rgba(251,191,36,.7)}100%{color:var(--ink);text-shadow:none}}#loader{position:absolute;inset:auto 0 0 0;height:4px;background:rgba(255,255,255,.06);border-radius:0 0 28px 28px;overflow:hidden;transition:opacity .6s}#loader.done,#loader.done+#loadtxt{opacity:0} #bar{height:100%;width:0;background:linear-gradient(90deg,#818cf8,#7dd3fc);transition:width .2s}#loadtxt{transition:opacity .6s;position:absolute;left:20px;bottom:12px;color:var(--dim);font:13px Inter;direction:ltr}.dock{display:flex;align-items:center;justify-content:center;gap:clamp(12px,3vw,28px);padding:22px 0 14px;flex-wrap:wrap}#rec{--s:clamp(84px,11vw,112px);width:var(--s);height:var(--s);border-radius:50%;border:0;cursor:pointer;position:relative;background:radial-gradient(circle at 35% 30%,#ff8aa0,var(--rec) 55%,#9f1239);box-shadow:0 12px 40px rgba(255,77,109,.35),inset 0 -6px 18px rgba(0,0,0,.25);transition:transform .15s,filter .3s}38 unmodified lines<div class="dock"><label class="btn" title="Upload audio"><svg viewBox="0 0 24 24"><path d="M5 20h14v-2H5v2zm7-16-5 5h3v6h4V9h3l-5-5z"/></svg>فایل<input id="file" type="file" accept="audio/*,video/*" hidden></label><button id="rec" aria-pressed="false" title="Record (Space)"><svg class="mic" viewBox="0 0 24 24"><path d="M12 14a3 3 0 0 0 3-3V5a3 3 0 0 0-6 0v6a3 3 0 0 0 3 3zm5-3a5 5 0 0 1-10 0H5a7 7 0 0 0 6 6.92V21h2v-3.08A7 7 0 0 0 19 11h-2z"/></svg><svg class="stop" viewBox="0 0 24 24"><rect x="6" y="6" width="12" height="12" rx="2"/></svg></button><button id="sample" class="btn" title="Try a sample (6 FLEURS sentences, 2 min)"><svg viewBox="0 0 24 24"><path d="M12 3v10.55A4 4 0 1 0 14 17V7h4V3h-6z"/></svg>نمونه</button><button id="clear" class="btn" title="Clear"><svg viewBox="0 0 24 24"><path d="M6 19a2 2 0 0 0 2 2h8a2 2 0 0 0 2-2V7H6v12zM19 4h-3.5l-1-1h-5l-1 1H5v2h14V4z"/></svg>پاک</button><button id="copy" class="btn" title="Copy"><svg viewBox="0 0 24 24"><path d="M16 1H4a2 2 0 0 0-2 2v14h2V3h12V1zm3 4H8a2 2 0 0 0-2 2v14a2 2 0 0 0 2 2h11a2 2 0 0 0 2-2V7a2 2 0 0 0-2-2zm0 16H8V7h11v14z"/></svg>کپی</button><div class="toggles"><label><input id="fix" type="checkbox" checked>اصلاح با بافت کامل</label><label><input id="lm" type="checkbox" checked>مدل زبانی</label><span id="filename"></span></div>
app.js+3-2
index.html+5-3