Skip to content

A machine learning–powered platform that predicts flood risk using historical and real-time data. Built with a user-friendly interface for visualization, early warnings, and decision support to aid communities and authorities in disaster preparedness.

License

Notifications You must be signed in to change notification settings

kumarvishal01971/Flood_probability_prediction

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

15 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

🌊 Flood Prediction Platform

A machine learning-powered Streamlit web application for predicting the likelihood of floods based on input features.
Built with Streamlit, scikit-learn, and Ngrok/pyngrok for sharing the app online.


✨ Features

  • 🔮 Predicts flood risk using a trained ML model (flood_prediction_model.joblib).
  • 📊 Scales input data with a pre-trained scaler (scaler.joblib).
  • 🌐 Deploys locally or shareable via Ngrok.
  • ⚡ Simple UI with real-time predictions powered by Streamlit.

🚀 Getting Started

For Local device run

1. Clone the Repository

git clone https://github.com/<your-username>/Flood_Prediction_Platform.git
cd Flood_Prediction_Platform

2. Install Dependencies

pip install -r requirements.txt

3. Run the Streamlit App Locally

Ensure App.py, flood_prediction_model.joblib, and scaler.joblib are in the same directory. Then run:

streamlit run app.py

The app will open automatically in your default web browser.

4. (Optional) Share the App Publicly with Ngrok (FOR GOOGLE COLAB)

Run Ngrok manually:

ngrok http 8501

5. from pyngrok import ngrok

public_url = ngrok.connect(8501) print(public_url) Use the public URL obtained after running this to access your app from anywhere.

📂 Project Structure

Flood_Prediction_Platform/

│── app.py ──> Streamlit app
│── requirements.txt ──> Dependencies list
│── README.md ──> Documentation
│── LICENSE ──> License file (MIT or others)

├── notebooks/
│ └── Flood_Prediction.ipynb ──> Notebook that trains model + saves joblib files

├── models/ ──> (Initially empty; gets filled when notebook runs)
│ ├── flood_prediction_model.joblib
│ └── scaler.joblib

├── data/ (optional) ──> Dataset (if you want to provide a sample CSV)

📌 Model Training

The model files (flood_prediction_model.joblib and scaler.joblib) are not included in the repository due to size restrictions.
To generate them:

  1. Open the notebook in Google Colab.
  2. Run all cells in notebooks/Flood_Prediction.ipynb.
  3. This will train the model and save the .joblib files into the models/ folder.
  4. A ngrok Auth token is required, obtain your's and Run the file after adding it in .ipynb file.
  5. An ngrok streamlit based link will be generated, click on the link to show the streamlit app.
  6. Once generated, you can run the Streamlit app as described above.

⚠️ Note on Environment Compatibility

This notebook is designed to run both on Google Colab and locally.
However, due to the use of ngrok for exposing local servers or APIs, some steps may behave differently depending on the environment:

  • Colab: Ngrok is required to tunnel local servers, and URLs generated will be publicly accessible.
  • Local: Ngrok can be used optionally; otherwise, the server can be accessed via localhost.

Make sure to follow the respective setup instructions for your environment.

📦 Requirements

Python 3.8+

  • Streamlit
  • scikit-learn
  • joblib
  • pyngrok

Install everything with:

pip install -r requirements.txt

About

A machine learning–powered platform that predicts flood risk using historical and real-time data. Built with a user-friendly interface for visualization, early warnings, and decision support to aid communities and authorities in disaster preparedness.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published