Inspiration
Ever been stuck in traffic wondering "how bad is it really?" We wanted to create something that doesn't just show you a route, but actually predicts what traffic will be like when you get there. Not yesterday's data, not right now - but what it'll be like in 30 minutes when you actually arrive. Best part, it can accurately predict up to 30 days in advance!
What it does
It uses machine learning to forecast congestion levels at any destination. You click on a map, pick your speed, and it gives:
- Real-time congestion predictions (with color-coded indicators: green/yellow/red)
- Accurate travel time estimates
- Vehicle count predictions
- Holiday detection (because traffic on Christmas is different!)
- Interactive map with origin/destination marker ## How we built it Started with a dataset of 100,000 traffic samples, then:
- Trained ML models (Random Forest) to predict congestion, vehicle count, and travel times
- Built a FastAPI backend with Python that serves predictions
- Created a sleek dark-mode UI with Mapbox for interactive maps
- Integrated Google Maps API for real route distances
- Added Gemini AI as a fallback when APIs fail
- Used haversine formula for distance calculations The congestion prediction uses this formula: \[ \text{Adjusted Time} = \text{Baseline Time} \times (1 + \text{Congestion Level} \times 0.5) \]
Challenges we ran into
- Spent hours debugging why new features weren't showing - turns out browsers really love caching!
- Google Maps isn't always available, so we built a 3-tier system (Google → Gemini → Haversine)
- Had to exclude 1.8GB of models from GitHub (thanks, 100MB limit!)
- Balancing prediction speed vs accuracy was tricky
What we learned
- Browser caching can make you question your entire existence
- ML models need a lot of data to be accurate
- Color-coding makes data instantly understandable
- Always have a fallback API (and a fallback for your fallback!)
What's next for Traffic_AI - Smart Traffic Predictor
- Add historical traffic patterns
- Multi-route comparison
- Mobile app version
- Weather integration
- Real-time traffic camera feeds
Built With
- css
- fastapi
- gemini-api
- google-maps
- heroku
- html5
- javascript
- mapbox
- matlab
- numpy
- pandas
- python
- scitlearn

Log in or sign up for Devpost to join the conversation.