Spaces:
Paused
Paused
Upload folder using huggingface_hub
Browse filesFiles changed (3)
- README.md+82-2
- static/nova.css+1
- static/nova.js+27-9
17 unmodified lines18192021222324252617 unmodified linesLiveKit ticket after a passcode check. It never touches audio and never talks tothe Pi: the browser and the Pi each dial out to a LiveKit server and meet in a room.```browser ─ passcode ─► this Space ─► ticket (10 min, 1 room, dispatch nova-<pi>)└──── WebRTC ────► LiveKit server ◄──── outbound, always on ──── Pi (all models local)```## Setting up a Pi17 unmodified lines1819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697989910010110210310410510617 unmodified linesLiveKit ticket after a passcode check. It never touches audio and never talks tothe Pi: the browser and the Pi each dial out to a LiveKit server and meet in a room.### What runs where```mermaidflowchart TBsubgraph B["Browser — laptop or phone, anywhere"]PAGE["Nova page<br/>orb · state · transcript · LLM switch · chime"]endsubgraph HF["This Space — Hugging Face, Docker"]DESK["POST /api/session<br/>passcode → scrypt check → signed ticket"]endsubgraph SFU["LiveKit server — self-hosted SFU"]ROOM["room nova-xxxx<br/>relays encrypted audio + data · no AI"]endsubgraph PI["Raspberry Pi 5 + Hailo NPU — one nova-hailo process"]direction TBWORKER["LiveKit Agents worker<br/>registered as nova-<hostname>"]WAKE["wake word on the caller's audio<br/>openWakeWord · nova_pro_v3"]SESS["AgentSession<br/>Silero VAD · endpointing · interruptions"]STT["Parakeet STT (CPU)"]PIPE["NovaPipeline<br/>router · tools · search · research<br/>LLM: Groq ⇄ Qwen2 on Hailo · Piper TTS"]LAN["/v1/realtime — LAN door<br/>in-car Qt HMI"]LEASE["SessionLease — one conversation at a time"]WORKER --> WAKE --> SESS --> STT --> PIPELAN --> PIPELEASE -.- WORKERLEASE -.- LANendPAGE -- "① passcode" --> DESKDESK -- "② url + ticket (10 min)" --> PAGEPAGE <-- "③ WebRTC audio + data" --> ROOMWORKER -. "outbound WSS, always on<br/>(no inbound port on the Pi)" .-> ROOMROOM -- "④ dispatch to nova-<hostname>" --> WORKERPIPE -- "⑤ Nova's voice (PCM → Opus)" --> ROOM```### Wake word and follow-upSame contract as the in-car HMI: nothing is transcribed while idle.```mermaidstateDiagram-v2[*] --> Idle: Nova joins the roomIdle --> Listening: "Hey Nova" or tap the orb · chimeListening --> Thinking: you stop talkingThinking --> Speaking: first audioSpeaking --> Listening: answer done · follow-up window restartsSpeaking --> Listening: you interruptListening --> Idle: 5 s of silence (livekit.followup_s)```### One conversation, step by step```mermaidsequenceDiagramautonumberactor U as You (browser)participant S as This Spaceparticipant R as LiveKit SFUparticipant W as Pi workerparticipant N as NovaPipelineNote over W: at boot: registers as nova-<hostname>U->>S: POST /api/session {passcode}S-->>U: url + ticket (1 room, dispatch nova-<hostname>)U->>R: join room, publish micR->>W: dispatch jobW->>W: take SessionLease, or reply "Nova is in use"W->>R: join as agentW-->>U: nova.state idleU->>R: "Hey Nova"R->>W: mic audio (16 kHz copy to the wake word)W-->>U: nova.state listening → chimeU->>R: "what's the weather in Chennai?"W->>W: VAD + endpointing → Parakeet → textW->>N: run_text_turn(text)N-->>W: Piper PCM, clause by clauseW->>R: Nova's voice + transcriptR-->>U: Nova speaksNote over U,W: 5 s of silence → nova.state idle```## Setting up a Pi
54 unmodified lines55565754 unmodified lines.controls { display: flex; align-items: center; gap: var(--u); padding-top: calc(2 * var(--u)); padding-bottom: env(safe-area-inset-bottom, 0px); }.metrics { flex: 1; text-align: center; font: 12px "SF Mono", "JetBrains Mono", monospace; color: var(--text-lo); }#mute[aria-pressed="true"] { color: var(--yellow); border-color: var(--yellow); }54 unmodified lines5556575854 unmodified lines.controls { display: flex; align-items: center; gap: var(--u); padding-top: calc(2 * var(--u)); padding-bottom: env(safe-area-inset-bottom, 0px); }.metrics { flex: 1; text-align: center; font: 12px "SF Mono", "JetBrains Mono", monospace; color: var(--text-lo); }#mute[aria-pressed="true"] { color: var(--yellow); border-color: var(--yellow); }#orb { cursor: pointer; }
10 unmodified lines1112131415161730 unmodified lines4849505152535454 unmodified lines10911011111211311411511611711811912072 unmodified lines19319419519619719819915 unmodified lines21521621721821922010 unmodified lineslet room = null;let agent = null;let chimed = false;let llmMode = null;let joinTimer = null;let analyser = null;30 unmodified lines}function onControl(msg) {switch (msg.type) {case "nova.settings": showLlm(msg); break;case "nova.llm_status":if (msg.status === "loading") { $("llm").disabled = true; $("llm").textContent = "Switching…"; }if (msg.status === "error") { say($("live-msg"), `Model switch failed: ${msg.error}`, true); send({ type: "nova.settings.get" }); }54 unmodified lines}function agentState(s) {if (!s) return;if (s === "listening" && !chimed) {// Joining is the wake event online: one chime when Nova is first ready.chimed = true;chime.play().catch(() => {});}setState(s === "initializing" ? "connecting" : s);}async function connect(passcode) {72 unmodified linesfunction hangUp(message = "", bad = false) {clearTimeout(joinTimer);const r = room;room = null; agent = null; chimed = false; analyser = null;if (r) r.disconnect();document.querySelectorAll("body > audio").forEach((a) => a.remove());$("transcript").replaceChildren();15 unmodified linesconnect($("passcode").value);});$("hangup").addEventListener("click", () => hangUp());$("mute").addEventListener("click", async () => {if (!room) return;const muted = $("mute").getAttribute("aria-pressed") === "true";10 unmodified lines1112131415161718192030 unmodified lines515253545556575859606162636465666754 unmodified lines12212312412512612712812913013113213313413513672 unmodified lines20921021121221321421515 unmodified lines23123223323423523623723810 unmodified lineslet room = null;let agent = null;// Two sources of state: the Pi's wake gate (idle until "Hey Nova") and// LiveKit's agent state (listening / thinking / speaking).let gate = "idle";let lkState = "listening";let llmMode = null;let joinTimer = null;let analyser = null;30 unmodified lines}function onControl(msg) {switch (msg.type) {case "nova.settings":showLlm(msg);if (msg.wake_state) { gate = msg.wake_state; render(); }break;case "nova.state":// idle -> listening is a wake: "Hey Nova", a tap, or (no wake word// configured) the session itself becoming ready. Chime on that edge.if (msg.state === "listening" && gate !== "listening") chime.play().catch(() => {});gate = msg.state;render();break;case "nova.llm_status":if (msg.status === "loading") { $("llm").disabled = true; $("llm").textContent = "Switching…"; }if (msg.status === "error") { say($("live-msg"), `Model switch failed: ${msg.error}`, true); send({ type: "nova.settings.get" }); }54 unmodified lines}function agentState(s) {if (!s) return;lkState = s;render();}function render() {if (!agent || lkState === "initializing") return setState("connecting");const busy = lkState === "thinking" || lkState === "speaking";// A closed gate shows Idle unless Nova is still talking (e.g. research).setState(gate === "idle" && !busy ? "idle" : lkState);say($("live-msg"), gate === "idle" && !busy ? "Say “Hey Nova” — or tap the orb." : "");}async function connect(passcode) {72 unmodified linesfunction hangUp(message = "", bad = false) {clearTimeout(joinTimer);const r = room;room = null; agent = null; gate = "idle"; lkState = "listening"; analyser = null;if (r) r.disconnect();document.querySelectorAll("body > audio").forEach((a) => a.remove());$("transcript").replaceChildren();15 unmodified linesconnect($("passcode").value);});$("hangup").addEventListener("click", () => hangUp());// Tap to talk: the same wake event as "Hey Nova", like the HMI's PTT.$("orb").addEventListener("click", () => { if (agent && gate === "idle") send({ type: "nova.wake" }); });$("mute").addEventListener("click", async () => {if (!room) return;const muted = $("mute").getAttribute("aria-pressed") === "true";
README.md+82-2
static/nova.css+1
static/nova.js+27-9