from __future__ import annotations import os def resolve_device() -> str: requested = os.getenv("MOUSE_DEMO_DEVICE", "auto").strip().lower() if requested == "cpu": return "cpu" if requested == "cuda": import torch return "cuda" if torch.cuda.is_available() else "cpu" # auto import torch return "cuda" if torch.cuda.is_available() else "cpu"