How harrythentrepreneur/omni works
Purpose and entry points
Omni is a camera-based “animated objects” system with two products: the browser Tracker at /, and a webcam-to-image Mirror at /mirror. The Next.js App Router shell begins in app/layout.tsx; main route selection is in app/page.tsx, app/mirror/page.tsx, and the newer Tracker variant in app/v2/page.tsx. Landing and gallery are separate presentation routes.
Tracker client and vision loop
components/tracker.tsx is the primary orchestration component: it captures camera frames, renders detections, accepts object taps, manages up to three active characters, and coordinates generation and speech. components/tracker-v2.tsx is a parallel implementation. Browser-local inference is encapsulated by lib/yolo.ts (with WebSocket-oriented alternative lib/yolo-ws.ts) and shipped ONNX assets in public/models/yolo26n-seg.onnx and public/models/yolo26n.onnx.
The critical boundary is client-side vision: raw camera imagery and continuous detection stay in the browser through ONNX Runtime Web (WebGPU/WASM), avoiding backend calls in the tracking loop.
Object identity, placement, and character rendering
Detection association and visual stability are handled through IoU, EMA smoothing, and anchor calculations in lib/iou.ts, consumed by the tracker. A selected detection becomes a persistent character/session record, supported by lib/session-cards.ts. components/face-voice.tsx renders the attached eyes/mouth animation; components/speech-bubble.tsx presents dialogue. Visual media is local under public/facevoice/.
An assessment service determines whether/where a face should be placed, creating a deliberate boundary between geometric local tracking and semantic placement judgment: app/api/assess/route.ts, app/api/describe/route.ts.
Character-generation and conversation services
The client invokes Next server endpoints/actions for object semantics and language. Initial object description/persona/opening-line generation flows through app/actions.ts and APIs including app/api/generate-line/route.ts and app/api/describe/route.ts. Subsequent conversational turns are served by app/api/converse/route.ts.
OpenAI provides vision/persona generation and fallback capabilities; Cerebras serves low-latency text conversations; Zhipu GLM handles visual placement/assessment. These keys remain server-side via environment configuration, while browser code receives only generated character data and responses.
Speech pipeline
Speech input is handled by app/api/speak/route.ts, with transcription-related logic in lib/whisper.ts. Text-to-speech has a streaming path at app/api/tts/stream/route.ts, supported by lib/tts.ts, plus app/api/tts/stream/route.ts for browser playback-oriented chunking. Fish.audio is the primary voice service, with OpenAI TTS fallback; character voice selection is tied to persona/session data. Bundled sample voices live in public/voices/.
Mirror subsystem
Mirror is an optional, separately deployed runtime: React UI in components/mirror.tsx and route app/mirror/page.tsx; Python FastAPI/WebSocket image processing in server/main.py, server/app.py, and server/yolo_ws.py. It receives webcam data, uses OpenCV and dlib facial landmarks, and composites eyes/mouth onto a selected base image. Its Python dependencies and model assets are operationally distinct from the Next.js tracker.
Mobile and alternate backends
react-native-executorch/ is a related Expo/React Native implementation, with its app entry at react-native-executorch/app/index.tsx, native detector abstraction in react-native-executorch/lib/detector.ts, and optional Python server under react-native-executorch/server/. server-v2/server.py is another standalone server variant. These are separate execution targets, not required for the browser Tracker.
Main entry points: tracker.tsx Tracker orchestrator · layout.tsx App shell & routes · yolo.ts Local object detection · tracker-v2.tsx Tracker v2
Components 20
Browser Tracker
Next.js client routes and browser-local vision.
- App shell & routes · Hosts Tracker, Mirror, and v2 routes.
app/layout.tsx - Tracker orchestrator · Captures frames, manages characters, and coordinates generation and speech.
components/tracker.tsx - Tracker v2 · Parallel tracker implementation.
components/tracker-v2.tsx - Local object detection · Runs WebGPU/WASM inference entirely in the browser.
lib/yolo.ts - YOLO model assets
public/models/yolo26n-seg.onnx - Detection stability · Associates detections and computes stable anchors.
lib/iou.ts - Character sessions · Persists selected object character records.
lib/session-cards.ts - Face and voice overlay · Attaches animated eyes and mouth to tracked objects.
components/face-voice.tsx - Speech bubbles
components/speech-bubble.tsx
Next Server
Server-side AI, assessment, and speech endpoints.
- Character generation · Creates object descriptions, personas, and opening lines.
app/actions.ts - Placement assessment · Makes semantic face-placement judgments.
app/api/assess/route.ts - Conversation service · Serves subsequent character dialogue turns.
app/api/converse/route.ts - Speech transcription · Accepts speech input for transcription.
app/api/speak/route.ts - Streaming TTS · Streams character speech for browser playback.
app/api/tts/stream/route.ts - AI providers · Server-held providers for vision, conversation, and placement.
- Voice providers · Primary voice synthesis with fallback.
Mirror Runtime
Separately deployed webcam image-processing service.
- Mirror UI · Sends webcam imagery to the optional Mirror runtime.
components/mirror.tsx - Mirror processor · Uses OpenCV and dlib landmarks to composite facial features.
server/main.py
Mobile Variant
Independent Expo/React Native execution target.
- Expo mobile app · Independent mobile implementation.
react-native-executorch/app/index.tsx - Native detector
react-native-executorch/lib/detector.ts
Connections 21
- App shell & routes → Tracker orchestrator: /
- App shell & routes → Tracker v2: /v2
- App shell & routes → Mirror UI: /mirror
- Tracker orchestrator → Local object detection: camera frames
- Tracker v2 → Local object detection: camera frames
- Local object detection → YOLO model assets: loads
- Tracker orchestrator → Detection stability: detections
- Detection stability → Character sessions: selected object
- Character sessions → Face and voice overlay: anchor and persona
- Tracker orchestrator → Speech bubbles: dialogue
- Tracker orchestrator → Character generation: object semantics
- Tracker orchestrator → Placement assessment: placement request
- Tracker orchestrator → Conversation service: conversation turn
- Tracker orchestrator → Speech transcription: recorded speech
- Tracker orchestrator → Streaming TTS: speak response
- Character generation → AI providers: vision and persona
- Placement assessment → AI providers: visual assessment
- Conversation service → AI providers: low-latency text
- Streaming TTS → Voice providers: voice synthesis
- Mirror UI → Mirror processor: webcam WebSocket
- Expo mobile app → Native detector: camera inference