Logo Lanfrica

annetadd/DisasterAPI

Type de record:

software
Créateur:
ann
Hôte:
A simple Disaster Prediction API built with FastAPI. The project uses a Decision Tree model trained on a simulated dataset inspired by the June 3rd disaster in Accra, Ghana. It demonstrates a complete machine learning pipeline (data preprocessing → training → evaluation → deployment as a REST API). Disaster Prediction API A simple Disaster Prediction API built with FastAPI. The project uses a Decision Tree Classifier trained on a simulated dataset inspired by the June 3rd 2015 disaster in Accra, Ghana. It demonstrates a complete machine learning pipeline: Data Preprocessing → Training → Evaluation → Deployment as a REST API Project Structure DisasterAPI/ ├── main.py # FastAPI app (API endpoints) ├── train_model.py # Script to train and save the model ├── model.pkl # Saved trained model ├── test_api.py # Script to test the API locally ├── requirements.txt # Dependencies └── README.md # Project documentation Requirements - Python 3.10+ - FastAPI - scikit-learn - pandas - joblib - uvicorn Install dependencies: pip install -r requirements.txt Running the API Start the FastAPI server: uvicorn main:app --reload Then open in your browser: Welcome Page: 127.0.0.1 Interactive Docs (Swagger UI): 127.0.0.1 Example Request POST → 127.0.0.1 Request Body (JSON): { "rainfall": 350, "drainage_quality": 0, "buildings_density": 0.85 } Response: { "prediction": 1, "result": "Disaster Likely" } Testing with Python Script You can also test using the included script: python test_api.py Model Details Algorithm: Decision Tree Classifier Dataset: Simulated disaster dataset with rainfall, drainage quality, and building density Output: Binary classification → 0 = No Disaster, 1 = Disaster Likely

Languages