Skip to content

WIZZ249/DamageSense-AI

Repository files navigation

🏚️ DamageSense AI

Python Flask TensorFlow License Status

AI-powered humanitarian dashboard for rapid structural damage assessment in disaster zones. Built with Flask, TensorFlow (MobileNetV2), and SQLAlchemy to support field-based disaster response.


📌 What It Does

DamageSense AI allows humanitarian field offices to upload images of structures and instantly receive:

  • AI Classification — identifies what the image contains using MobileNetV2
  • Severity Rating — automatically flags as CRITICAL or STABLE
  • Heuristic Override — catches dangerous misclassifications (e.g. "Seashore" bug fix)
  • Assessment History — all results saved to a local SQLite database
  • REST API — JSON endpoints for integration with other systems

🖥️ Tech Stack

Layer Technology
Backend Python, Flask 3.0
AI / ML TensorFlow 2.15, MobileNetV2, Keras
Database SQLAlchemy, SQLite
Frontend Bootstrap 5, HTML5
Testing Pytest
Deployment Gunicorn, Render.com

📁 Project Structure

DamageSense-AI/
├── app/
│   ├── __init__.py       # App factory & database setup
│   ├── routes.py         # All Flask routes & API endpoints
│   ├── models.py         # SQLAlchemy database models
│   ├── ai_engine.py      # TensorFlow model & classification logic
│   └── static/
│       ├── css/          # Stylesheets
│       └── uploads/      # Uploaded images
├── templates/
│   └── upload.html       # Main dashboard UI
├── tests/
│   └── test_app.py       # Pytest test suite
├── .env.example          # Environment variable template
├── requirements.txt      # Python dependencies
├── run.py                # Application entry point
└── README.md

⚙️ Installation & Setup

1. Clone the repository

git clone https://github.com/WIZZ249/DamageSense-AI.git
cd DamageSense-AI

2. Create a virtual environment

python -m venv venv
venv\Scripts\activate        # Windows
source venv/bin/activate     # Mac/Linux

3. Install dependencies

pip install -r requirements.txt

4. Set up environment variables

cp .env.example .env

5. Run the application

python run.py

Visit http://localhost:5000 in your browser.


🔌 API Endpoints

Method Endpoint Description
GET / Main dashboard UI
POST /assess Upload image for AI assessment
GET /history Retrieve last 50 assessments
GET /health Health check for deployment

Example — POST /assess

curl -X POST http://localhost:5000/assess \
  -F "image=@/path/to/image.jpg"

Example Response

{
  "id": 1,
  "filename": "building.jpg",
  "label": "rubble",
  "confidence": 94.32,
  "severity": "CRITICAL",
  "timestamp": "2026-03-12 22:00:00"
}

🧪 Running Tests

pytest tests/

🐛 Known Issues Fixed

Bug Fix
MobileNetV2 classifying damaged buildings as "Seashore" Implemented keyword-based heuristic override layer
Session persistence between requests Implemented SQLAlchemy scoped_session pattern

🚀 Deployment

This app is configured for deployment on Render.com:

  1. Push your code to GitHub
  2. Go to render.com → New Web Service
  3. Connect your DamageSense-AI repo
  4. Set start command: gunicorn run:app
  5. Click Deploy

👨‍💻 Author

Ahmed Salaheldeen Alamin Sulieman IT Engineer | AWS Certified Cloud Practitioner | Developer


📄 License

This project is licensed under the MIT License.


Built with purpose — for the people who need it most.

About

AI-powered humanitarian dashboard for rapid structural damage assessment. Built with Flask, TensorFlow (MobileNetV2), and SQLAlchemy.

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors