How google-gemma/gemma-translator works
Gemma Translator is an offline, two-person voice translation kiosk: a user selects languages and records speech, which is transcribed by Moonshine, translated by a local Gemma-compatible model, and optionally spoken in the other lane’s language. The graph also captures settings, audio visualization, and system-volume control. The README documents the LiteRT-LM runtime and TTS capability; excerpts do not show every backend handler or the complete playback path, so those links are limited to documented responsibilities and visible API usage.
Main entry points: TranslatorApp.jsx Translation workflow · server.py Python API server · api.js Translation API client · App.jsx App shell
Components 16
Kiosk interface
- App shell
frontend/src/App.jsx - Translation workflow
frontend/src/TranslatorApp.jsx - Language lanes
frontend/src/components/LanguageLane.jsx - Settings overlay
frontend/src/components/SettingsOverlay.jsx - Audio visualizer
frontend/src/components/Visualizer.jsx - UI sound effects
frontend/src/utils/audio-blip.js
Speech processing
- Microphone recorder
frontend/src/hooks/useAudioRecorder.js - Audio preparation
frontend/src/utils/audioHelpers.js - Python API server
backend/server.py - Moonshine STT
- Moonshine TTS
Local translation
- Translation API client
frontend/src/utils/api.js - LLM proxy
backend/server.py - Gemma inference
Device services
- System audio
Other components
- Kiosk users
Connections 19
- Kiosk users → App shell: uses
- App shell → Translation workflow: renders
- App shell → Settings overlay: opens
- Translation workflow → Language lanes: renders
- Translation workflow → Microphone recorder: captures
- Microphone recorder → Audio preparation: prepares PCM
- Translation workflow → Audio visualizer: displays audio
- Translation workflow → UI sound effects: plays cues
- Translation workflow → Translation API client: requests transcription
- Translation API client → Python API server: posts audio
- Python API server → Moonshine STT: transcribes
- Translation workflow → Translation API client: requests translation
- Translation API client → Python API server: proxies request
- Python API server → LLM proxy: forwards request
- LLM proxy → Gemma inference: queries model
- Translation workflow → Python API server: requests speech
- Python API server → Moonshine TTS: synthesizes speech
- Settings overlay → Python API server: controls volume
- Python API server → System audio: reads or adjusts