Make Edge TPU opt-in via USE_EDGETPU env var

libedgetpu on Pi 5 segfaults with the compiled model.
CPU fallback works fine (~50-100ms at 0.5s intervals).
Set USE_EDGETPU=1 in headmic.service to enable once runtime is fixed.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
This commit is contained in:
Alex
2026-04-11 17:24:04 -05:00
parent c96d6958a3
commit 43f40bf48c

View File

@@ -469,8 +469,8 @@ async def startup():
edgetpu_model_path = model_dir / "yamnet_edgetpu.tflite"
model_path = model_dir / "yamnet.tflite"
class_map_path = model_dir / "yamnet_class_map.csv"
# Prefer Edge TPU model if available
use_edgetpu = edgetpu_model_path.exists()
# Edge TPU opt-in via env var (segfaults with some libedgetpu versions)
use_edgetpu = os.environ.get("USE_EDGETPU", "").lower() in ("1", "true", "yes") and edgetpu_model_path.exists()
active_model = edgetpu_model_path if use_edgetpu else model_path
if active_model.exists() and class_map_path.exists():
try: