Download runtime/index.html from cdismus4/chimera-jev-full-duplex: direct link, hf CLI and curl.
- Browser
- Download file 4.21 kB
-
https://huggingface.co/cdismus4/chimera-jev-full-duplex/resolve/main/runtime/index.html
- Command line
-
hf download hf://cdismus4/chimera-jev-full-duplex/runtime/index.html
-
curl -L -o index.html https://huggingface.co/cdismus4/chimera-jev-full-duplex/resolve/main/runtime/index.html
4.21 kB
| <html lang="ja"> | |
| <head> | |
| <meta charset="utf-8"> | |
| <meta name="viewport" content="width=device-width, initial-scale=1"> | |
| <title>CHIMERA-Jev ランタイムキット デモ</title> | |
| <style> | |
| body { font-family: sans-serif; margin: 16px; background: #faf6ee; color: #222; } | |
| button { font-size: 15px; padding: 8px 14px; margin: 4px 4px 4px 0; } | |
| #said { font-size: 22px; min-height: 32px; margin: 12px 0; } | |
| #log { font-size: 11px; white-space: pre-wrap; background: #fff; border: 1px solid #ccc; padding: 8px; height: 220px; overflow-y: auto; } | |
| .row { margin: 8px 0; } | |
| .lbl { font-size: 12px; color: #666; } | |
| </style> | |
| </head> | |
| <body> | |
| <h3>CHIMERA-Jev ランタイムキット デモ</h3> | |
| <div class="row"> | |
| <button id="startBtn">開始</button> | |
| <span id="status">未起動</span> | |
| </div> | |
| <div id="said"></div> | |
| <div class="row"> | |
| <div class="lbl">返事の意図(語彙バンクから)</div> | |
| <div id="replyBtns"></div> | |
| </div> | |
| <div class="row"> | |
| <div class="lbl">状況の意図</div> | |
| <button id="barkBtn" disabled>いくよ(バーク)</button> | |
| </div> | |
| <div id="log"></div> | |
| <script type="module"> | |
| import { startBody, packAssets } from './src/start.js'; | |
| // 資産の置き場。既定は同梱レイアウト:このキットがパックの runtime/ に | |
| // 置かれる形を前提に、親フォルダ(../)をパックのルートとし、ONNX Runtime | |
| // Web 一式は ../vendor/ に置く想定。 | |
| // 耳の既定は同梱の蒸留生徒耳(ear/student_rf4.onnx、凍結パック外の別枠同梱。 | |
| // W=4 推奨動作点はこちら)。教師耳で試す場合は | |
| // ?ear=../ear/mimi-encoder-selfexport.onnx のように指定する。 | |
| // 差し替えはクエリパラメータで:?ear=<パス>、?vendor=<パス>。 | |
| const params = new URLSearchParams(location.search); | |
| const assets = packAssets('../', { | |
| vendorBase: '../vendor/', | |
| ear: '../ear/student_rf4.onnx', | |
| ...(params.get('ear') ? { ear: params.get('ear') } : {}), | |
| ...(params.get('vendor') ? { vendorBase: params.get('vendor') } : {}), | |
| }); | |
| const logEl = document.getElementById('log'); | |
| const statusEl = document.getElementById('status'); | |
| const saidEl = document.getElementById('said'); | |
| const lines = []; | |
| function log(m) { | |
| lines.push(m); | |
| if (lines.length > 40) lines.shift(); | |
| logEl.textContent = lines.join('\n'); | |
| logEl.scrollTop = logEl.scrollHeight; | |
| } | |
| let core = null; | |
| document.getElementById('startBtn').addEventListener('click', async (ev) => { | |
| ev.target.disabled = true; | |
| statusEl.textContent = '起動中…'; | |
| try { | |
| const audioCtx = new AudioContext(); | |
| await audioCtx.resume(); | |
| let micStream = null; | |
| try { | |
| micStream = await navigator.mediaDevices.getUserMedia({ | |
| audio: { echoCancellation: true, noiseSuppression: true, autoGainControl: true }, | |
| }); | |
| } catch (e) { | |
| log('マイクが使えないため無音で起動します: ' + e.message); | |
| } | |
| const started = await startBody({ | |
| audioCtx, micStream, assets, log, | |
| onUtterance: (text) => { saidEl.textContent = '「' + text + '」'; }, | |
| onProgress: (p) => { statusEl.textContent = p.status; }, | |
| }); | |
| core = started.core; | |
| statusEl.textContent = '稼働中'; | |
| // 返事の意図ボタン:語彙バンクの TAKE_TURN 語から作る | |
| const btns = document.getElementById('replyBtns'); | |
| const turns = core.bank.entries.filter((e) => e.role === 'TAKE_TURN').slice(0, 4); | |
| for (const e of turns) { | |
| const b = document.createElement('button'); | |
| b.textContent = e.display; | |
| b.addEventListener('click', () => { | |
| core.setIntent({ | |
| kind: 'reply', tag: 'demo', | |
| text: e.kana, show: e.display, | |
| rateMul: e.rateMul, pitchOffsetHz: e.pitchOffsetHz, | |
| }); | |
| }); | |
| btns.appendChild(b); | |
| } | |
| document.getElementById('barkBtn').disabled = false; | |
| } catch (e) { | |
| statusEl.textContent = '起動失敗'; | |
| log('起動失敗: ' + (e && e.message ? e.message : e)); | |
| } | |
| }); | |
| document.getElementById('barkBtn').addEventListener('click', () => { | |
| if (!core) return; | |
| core.setSituationIntent('departure', { text: 'いくよ', rateMul: 1.0, pitchOffsetHz: 6 }); | |
| }); | |
| </script> | |
| </body> | |
| </html> | |