AI-Powered Accident Prevention System
EPICS 2025 > Engineering safer futures by prioritizing survival over speed.
Conventional navigation apps (Google Maps, Waze) optimize for time and distance. They often route drivers through hazardous blackspots, narrow lanes, or unlit roads just to save a few seconds.
SafeRoute AI represents a paradigm shift in routing logic. By fusing satellite imagery, geometric vector analysis (road curvature), and real-time environmental data, we calculate a Probabilistic Safety Score (0-100) for every route. We don't just tell you the fastest way; we tell you the safest way.
- Uses OSMnx & NetworkX to download real-world road networks.
- Calculates Road Curvature using vector math to identify sharp, dangerous turns.
- Detects infrastructure risks like Narrow Roads, Poor Lighting, and High-Speed Zones.
- Integrated Google Gemini 2.5 Flash-Lite LLM.
- Provides real-time advice on road safety, first aid protocols, and route details.
- Smart Fallback System: Automatically switches to an internal rule-based mode if the internet connection is unstable.
- Real-time AQI (Air Quality Index): Fetched via Open-Meteo API to warn drivers of low visibility due to smog/pollution.
- Weather Integration: Live temperature and condition monitoring.
- SOS Panic Button: One-click access to National Emergency (112), Police (100), and Ambulance (102).
- Simulated Computer Vision: Analyzes road surface quality (Simulated for cloud optimization).
- Dark/Light Mode: Aesthetic UI with Glassmorphism design.
| Component | Technology Used |
|---|---|
| Frontend | HTML5, CSS3 (Glassmorphism), JavaScript (ES6) |
| Mapping | Leaflet.js, OpenStreetMap (OSM) |
| Backend | Python 3, Flask (RESTful API) |
| Data & Graph | OSMnx, NetworkX, NumPy, Pandas |
| AI Model | Google Gemini 2.5 Flash-Lite (via API) |
| Weather API | Open-Meteo API |
| Deployment | Render Cloud (Gunicorn Server) |
Running complex AI and Graph computations on a free cloud tier (512MB RAM) required significant engineering optimization:
- Dynamic Radius Calculation: The backend calculates the exact distance between points and only downloads the specific map chunk needed (clamped to 2.5km) to prevent OOM (Out of Memory) crashes.
- Lazy Loading: Heavy libraries like
cv2(OpenCV) are only imported into memory when specifically requested. - Garbage Collection: Aggressive Python
gc.collect()calls ensure memory is freed immediately after route generation.
If you want to run this project on your own machine for full performance (unlimited range):
-
Clone the Repository
git clone [https://github.com/Priyanksolanki9853/accident-route-advisor.git](https://github.com/Priyanksolanki9853/accident-route-advisor.git) cd accident-route-advisor -
Install Dependencies
pip install -r requirements.txt
-
Set up API Key
- Create a
.envfile or set it in your terminal: export GEMINI_API_KEY="your_google_api_key_here"
- Create a
-
Run the Server
python app.py
-
Access the App
- Open your browser and go to:
http://127.0.0.1:5000
- Open your browser and go to:
- Developer: Priyank Solanki
- Contact: priyanksolanki9853@gmail.com
- Privacy Policy: This application processes location data in real-time for routing purposes only. No user location history is stored on our servers.
Β© 2025 SafeRoute AI. Designed for Safer Roads.