Gemma Translator:用树莓派 5 做一台完全离线的双向语音翻译机

Gemma Translator: A Fully Offline Two-Way Voice Translator on a Raspberry Pi 5

Tech-News #Gemma#语音翻译#离线AI#树莓派#LiteRT#本地推理#Mycelium
更新于
🇨🇳 中文

by Mycelium Protocol


大多数实时翻译方案都依赖云端——连不上网就不工作,隐私问题无法回避,延迟受网络状况左右。

Gemma Translator 用一块树莓派 5 解决这个问题:Gemma 4 模型通过 LiteRT-LM 完全在本地运行,Moonshine 负责语音转文字和文字转语音,整个链路不需要任何外部请求。设备上电就能用,断网照常工作。

GitHub: https://github.com/google-gemma/gemma-translator | Apache 2.0 | JavaScript / Python


硬件组合

组件规格
主板Raspberry Pi 5(8GB RAM
音频输入麦克风或 USB 音频采集卡
音频输出扬声器或耳机
显示屏任意屏幕,建议 480×320 小触摸屏(kiosk 场景)

仓库里附有 STL 文件,可以打印配套外壳,做成完整的独立设备。


技术栈

用户语音(麦克风)

Moonshine STT(语音转文字)

Gemma 4 (gemma4-e2b) via LiteRT-LM(翻译推理,纯本地)

moonshine-voice TTS(文字转语音)

扬声器输出
  • LiteRT-LM:Google 的轻量级本地推理引擎,专为边缘设备优化
  • Gemma 4(gemma4-e2b):2B 参数的小型多语言模型,在树莓派 5 上可以实时推理
  • Moonshine:专注低延迟的本地 STT/TTS,不依赖云端

双通道设计

这是这个项目最有意思的部分:它不是单向翻译,而是两个人面对面使用同一台设备

界面有两个”通道”(Lane),各自对应一个人,各自设置语言。每个人说话,系统识别、翻译,用另一侧的语言在扬声器播放。两侧可以独立操作,也可以用”单人模式”轮流控制。

通道 1(Person 1)  ←→  通道 2(Person 2)
  中文 ──────────────────── 英文
  说话 → STT → Gemma 翻译 → TTS → 对方听到

两种键盘模式:

  • Landscape 模式(默认):Spacebar 切换当前活跃通道,Z 键按住说话
  • Vertical 模式:两通道各自有独立按键(Z / X),两人可以同时操作

快速上手

# 1. 授权脚本
chmod +x setup.sh download_model.sh start.sh deploy-pi.sh

# 2. 安装 Python 依赖(创建 venv)
./setup.sh

# 3. 下载 gemma4-e2b 模型(从 Hugging Face 导入 LiteRT-LM)
./download_model.sh

# 4. 启动(开发模式)
./start.sh

# 或生产模式(跳过 Vite dev server,从 dist/ 直接服务)
./start.sh --prod

启动后访问:

  • 开发模式 UI:http://localhost:5173
  • 生产模式 / API:http://localhost:3000
  • LiteRT-LM:http://localhost:9379

树莓派一键永久部署

./deploy-pi.sh

这个脚本在 Raspberry Pi OS / Debian 上自动完成:安装系统依赖、创建 Python 环境、构建生产前端、下载 LiteRT 模型、注册 systemd 服务,并配置 LXDE 自动启动 Chromium kiosk 模式(指向 http://localhost:3000)。重启后设备直接进入翻译界面,不需要登录或手动操作。


背景

这个项目是 Google Antigravity 实验(antigravity.google)的产物——一个专门做硬件+AI 边缘计算实验的项目组。代码在 Apache 2.0 下开源,仓库里附有 STL 外壳文件,整个设计对社区完全开放。


Mycelium Protocol — 追踪 AI 系统的底层演化


关于 Mycelium

菌丝协议。持续追踪 AI 工具、系统和实验的内容节点。


🇬🇧 English

Gemma Translator: A Fully Offline Bidirectional Voice Translator on a Raspberry Pi 5

by Mycelium Protocol


Most real-time translation solutions depend on the cloud — they stop working offline, raise privacy concerns, and are subject to network latency.

Gemma Translator solves this with a Raspberry Pi 5: Gemma 4 runs entirely locally via LiteRT-LM, Moonshine handles speech-to-text and text-to-speech, and the entire pipeline makes no external requests. Power it on and it works — no internet required.

GitHub: https://github.com/google-gemma/gemma-translator | Apache 2.0 | JavaScript / Python


Hardware

ComponentSpec
BoardRaspberry Pi 5 (8GB RAM)
Audio inputMicrophone or USB audio capture interface
Audio outputSpeaker or headphone output
DisplayAny screen; 480×320 kiosk touchscreen recommended

STL files for a 3D-printed enclosure are included in the repo — the whole design is open hardware.


The Pipeline

User voice (microphone)

Moonshine STT (speech-to-text)

Gemma 4 (gemma4-e2b) via LiteRT-LM (translation inference, fully local)

moonshine-voice TTS (text-to-speech)

Speaker output
  • LiteRT-LM: Google’s lightweight local inference engine for edge devices
  • Gemma 4 (gemma4-e2b): 2B-parameter multilingual model that runs in real time on a Pi 5
  • Moonshine: Low-latency local STT/TTS — no cloud dependency

Two-Lane Design

The most interesting design choice: this isn’t one-way translation. Two people face the same device, each on their own lane with their own language set. Each person speaks, the system transcribes, translates, and plays back through the speaker in the other person’s language.

Lane 1 (Person 1) ←→ Lane 2 (Person 2)
  Chinese ─────────────── English
  Speak → STT → Gemma → TTS → other person hears

Two keyboard modes:

  • Landscape (default): Spacebar switches the active lane, Z (hold) records active person
  • Vertical (“two-hand”): Each lane has its own dedicated keys — Z for Person 1, X for Person 2

Quick Start

chmod +x setup.sh download_model.sh start.sh deploy-pi.sh
./setup.sh            # create Python venv, install dependencies
./download_model.sh   # fetch gemma4-e2b from HuggingFace → LiteRT-LM
./start.sh            # launch LiteRT-LM + Python API + Vite frontend
./start.sh --prod     # production: serve compiled assets from dist/
  • Dev UI: http://localhost:5173
  • Prod / API: http://localhost:3000
  • LiteRT-LM: http://localhost:9379

One-Command Permanent Kiosk Deployment

./deploy-pi.sh

On Raspberry Pi OS / Debian, this script automatically: installs system packages, sets up the Python environment, builds production frontend, downloads the LiteRT model, registers a systemd service, and configures LXDE autostart to launch Chromium in kiosk mode pointing at http://localhost:3000. After reboot, the device goes straight into the translator interface — no login, no manual steps.


Background

This project came out of Google Antigravity (antigravity.google) — Google’s hardware + edge AI experimental group. The code is Apache 2.0, the STL enclosure files are in the repo, and the full design is open to the community.


Mycelium Protocol — tracking the deep evolution of AI systems

© 2026 Mycelium Protocol. All rights reserved.

💬 评论与讨论

使用 GitHub 账号登录后发表评论

关于本站 · 免责声明

🍄 Mushroom Research Blog 是非营利、免费公开的个人科技观察博客与公众号 XStack18,不接受商业合作、不代表任何企业或机构立场,也不谋求商业利益。我们以个人视角客观中立地记录和分析 AI、Web3 等领域的最新模型发布与技术动态——不止转述新闻标题或二手信息,而是给出有独立思考的深入分析,希望帮更多人获得有价值的一手科技认知。

⚠️ 文中介绍的开源代码与模型,仅供学习交流与技术借鉴。它们大多仍处于早期阶段,有待进一步研究和验证,请勿直接用于工作或生产环境;如需采用,请先自行充分测试,并核实其许可证与安全性。
Open-source code and models featured here are shared for learning and reference only. Most are early-stage and still need further study and verification — please don't use them directly in your work or in production. Test them thoroughly and check their licenses and security first.

  1. 本站文章均为作者基于公开信息的个人研究与观点整理,不代表文中提及的任何公司、产品、模型的官方立场,未与其构成商业关联或合作关系。
  2. 科技行业信息更新极快,我们尽力保证内容准确、及时,但不对完整性、实时性做绝对保证,具体请以相关企业/项目官方公告为准。
  3. 文中引用的第三方商标、产品名称、图片、数据等版权归原权利人所有,我们会尽量注明来源;如你认为存在版权疑问或侵权,请通过下方邮箱联系我们,收到通知后会尽快核实处理(更正、加注来源或删除)。
  4. 文章内容仅为技术科普与个人观点,不构成投资、法律或其他专业建议,据此进行任何决策的后果需自行判断和承担。

📮 侵权 / 勘误 / 合作咨询:[email protected]