{"slug": "gemma-translator", "title": "Gemma Translator", "summary": "Google's Gemma Translator, built with Google Antigravity, enables fully offline, on-device voice translation using the Gemma 4 large language model and LiteRT-LM, with text-to-speech powered by Moonshine. The project includes a web frontend optimized for small displays and a Python API server, supporting deployment on a Raspberry Pi 5 with 8GB RAM. It offers two keyboard modes and a two-lane interface for two-person conversations, with all processing done locally after initial setup.", "body_md": "This repo was built with the assistance of [Google Antigravity](https://antigravity.google/) and includes code to run an on-device, fully offline voice translator powered by [Gemma 4](https://ai.google.dev/gemma/docs/core) and [LiteRT-LM](https://github.com/google-ai-edge/LiteRT-lm). This project features a web frontend optimized for small handheld displays (e.g., 480x320) and a Python API server (`http.server`\n\n) that communicates with Gemma. Text-to-speech is powered by [Moonshine](https://github.com/moonshine-ai/moonshine).\n\n## demo.mp4\n\n**On-Device Inference**: Uses LiteRT-LM to run the`gemma4-e2b`\n\nmodel entirely locally. No internet required after setup.**Voice Interface**: Captures microphone audio, processes it, and sends it to the local model.** Optimized UI**: Retro-terminal styling custom-built for small hardware screens (like Raspberry Pi displays).** Unified Startup**: One script to launch the LLM server, the Python API, and the React frontend.\n\n- Python 3.10+\n- Node.js 18+ (20 LTS recommended) & npm — installed automatically by\n`deploy-pi.sh`\n\non Raspberry Pi OS / Debian - Linux or macOS\n\n**Compute**: Raspberry Pi 5 with 8GB RAM** Audio Input**: Microphone or USB audio capture interface** Audio Output**: Speaker or headphone output device** Display**: Display monitor or touchscreen (e.g., 480x320 kiosk display)\n\n-\n**Make Scripts Executable** Ensure the setup, download, start, and deployment scripts have execute permissions:\n\n```\nchmod +x setup.sh download_model.sh start.sh deploy-pi.sh\n```\n\n-\n**Install Dependencies** Run the setup script to create a Python virtual environment (`venv`\n\n) and install all required packages:\n\n```\n./setup.sh\n```\n\n-\n**Download the Model** Run the model downloader script to fetch the`gemma4-e2b`\n\nmodel from Hugging Face and import it into LiteRT-LM:\n\n```\n./download_model.sh\n```\n\nStart all services (LiteRT-LM, the Python API server, and the Vite Web UI) in development mode:\n\n```\n./start.sh\n```\n\nTo run in production mode (skipping Vite dev server and serving compiled UI assets from `frontend/dist/`\n\nvia `backend/server.py`\n\non port 3000):\n\n```\n./start.sh --prod\n```\n\nThe application will be accessible at:\n\n**Web UI (Dev)**:`http://localhost:5173`\n\n**Web UI (Prod) / API server**:`http://localhost:3000`\n\n**LiteRT-LM**:`http://localhost:9379`\n\nTo deploy as a permanent systemd kiosk service on a Raspberry Pi 5 (8GB):\n\n```\n./deploy-pi.sh\n```\n\nThis automated script installs Debian audio/venv packages, sets up the Python environment, builds production UI assets, downloads the LiteRT model, registers the systemd unit from `deploy/gemma-translator.service`\n\n, and configures LXDE GUI autostart (`~/.config/lxsession/rpd-x/autostart`\n\n) to launch Chromium in kiosk mode pointing to `http://localhost:3000`\n\n.\n\n`frontend/`\n\n- React (Vite) web frontend (`index.html`\n\n,`src/`\n\n, styles, and Vite configuration).`backend/`\n\n- Python API server (`server.py`\n\nand`requirements.txt`\n\n) for Moonshine STT, moonshine-voice TTS, and model proxying.`deploy/`\n\n- Parameterizable systemd service unit template (`gemma-translator.service`\n\n).`stl/`\n\n- STL files for 3D printing the hardware case.`setup.sh`\n\n- Automates Python virtual environment creation and dependency installation.`download_model.sh`\n\n- Fetches the required LiteRT model.`start.sh`\n\n- Multi-process launcher supporting`--prod`\n\nand development modes.`deploy-pi.sh`\n\n- One-command Raspberry Pi automated deployment script.\n\nThe Gemma Translator supports **two keyboard modes**. Switch between them anytime from the **Settings panel → \"Keyboard Mode\"** dropdown. The choice is remembered across restarts (stored in the browser's `localStorage`\n\nunder the key `keyboardMode`\n\n).\n\nThe app has two lanes (two people facing each other on the kiosk):\n\n**Lane 1 / Person 1**— the left/top lane.** Lane 2 / Person 2**— the right/bottom lane.\n\nEach lane has a rotating language \"revolver\" and records speech, which is transcribed (Moonshine STT), translated (Gemma), and spoken back in the other lane's language (moonshine-voice TTS).\n\nOne lane is the **active person** at a time. The active lane is framed with **corner brackets on all four corners**. You drive everything from a single set of keys and switch focus with Space.\n\n| Key | Action | Description |\n|---|---|---|\nSpacebar |\nSwitch active person | Toggles the active lane (Person 1 ⇄ Person 2). Disabled while recording. |\nZ |\nRecord (push-to-talk) | Hold to record the active person; release to transcribe & translate. |\n← Left Arrow |\nPrevious language | Rotates the active person's language backward. |\n→ Right Arrow |\nNext language | Rotates the active person's language forward. |\n\nNotes:\n\n- The active lane shows four-corner brackets; while it is recording, the brackets invert to black along with the lane's color reversal.\n- Best for one-handed / single-operator use.\n\nEach lane has its **own dedicated keys** — there is no active-person concept and **no bracket highlight**. Both people can be controlled independently.\n\n| Key | Action | Description |\n|---|---|---|\nZ |\nRecord — Person 1 (push-to-talk) | Hold to record Lane 1; release to transcribe & translate. |\nX |\nRecord — Person 2 (push-to-talk) | Hold to record Lane 2; release to transcribe & translate. |\n← Left Arrow |\nPrevious language — Person 1 | Rotates Lane 1's language backward. |\n→ Right Arrow |\nNext language — Person 1 | Rotates Lane 1's language forward. |\n− Minus (`_` ) |\nPrevious language — Person 2 | Rotates Lane 2's language backward. |\n+ Plus (`=` ) |\nNext language — Person 2 | Rotates Lane 2's language forward. |\n\nNotes:\n\n- No corner-bracket selection highlight in this mode.\n- Best for two operators, each handling their own side.\n\n**Input focus guard:** all shortcuts are ignored while focus is on a configuration field (`<input>`\n\n,`<textarea>`\n\n, or`<select>`\n\n) — e.g. when editing the API endpoint or settings.**Recording lock:** language rotation is blocked while a recording is in progress.**Keyboard-driven:** recording and language rotation are keyboard-only in the current build; on-screen touch controls are not enabled.\n\nOpen **Settings (⚙)** → **Keyboard Mode** → choose **Landscape** or **Vertical**. The change takes effect immediately and persists on the device.\n\n| Setting value | Mode |\n|---|---|\n`landscape` |\nActive-person scheme (Space / Z / ← →) — default |\n`vertical` |\nTwo-hand scheme (Z / X / ← → / − +) |\n\nMade by a small team at [Google Creative Lab](https://github.com/googlecreativelab):\n\nThis is not an officially supported Google product. This project is not\neligible for the [Google Open Source Software Vulnerability Rewards\nProgram](https://bughunters.google.com/open-source-security).", "url": "https://wpnews.pro/news/gemma-translator", "canonical_source": "https://github.com/google-gemma/gemma-translator", "published_at": "2026-08-11 14:29:51+00:00", "updated_at": "2026-08-11 14:42:16.110747+00:00", "lang": "en", "topics": ["artificial-intelligence", "large-language-models", "ai-products", "ai-tools", "ai-infrastructure"], "entities": ["Google", "Gemma 4", "LiteRT-LM", "Moonshine", "Google Antigravity", "Raspberry Pi 5", "Hugging Face", "React"], "alternates": {"html": "https://wpnews.pro/news/gemma-translator", "markdown": "https://wpnews.pro/news/gemma-translator.md", "text": "https://wpnews.pro/news/gemma-translator.txt", "jsonld": "https://wpnews.pro/news/gemma-translator.jsonld"}}