Gemini-powered traffic intersection automation with a live Pygame intersection, AI light decisions, and dashboard stats.
This project simulates a 4-way traffic intersection and uses Gemini as the traffic decision engine. At runtime, the app:
- Builds a traffic state from the simulation.
- Sends that state to Gemini.
- Receives a decision (
next_light,duration_seconds,explanation). - Applies the decision and renders the next frame.
python -m venv .venv
source .venv/bin/activate
pip install -r requirements.txt
python -m src.mainEdit .env and set your key:
GEMINI_API_KEY=your_real_key_here
GEMINI_MODEL=gemini-1.5-flashPYTHONPATH=. pytest -qpygameis included inrequirements.txtfor GUI mode.- Launch the simulation with
python -m src.main.