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.
- 🔮 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.
git clone https://github.com/<your-username>/Flood_Prediction_Platform.git
cd Flood_Prediction_Platformpip install -r requirements.txtEnsure App.py, flood_prediction_model.joblib, and scaler.joblib are in the same directory. Then run:
streamlit run app.pyThe app will open automatically in your default web browser.
Run Ngrok manually:
ngrok http 8501public_url = ngrok.connect(8501) print(public_url) Use the public URL obtained after running this to access your app from anywhere.
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)
The model files (flood_prediction_model.joblib and scaler.joblib) are not included in the repository due to size restrictions.
To generate them:
- Open the notebook in Google Colab.
- Run all cells in
notebooks/Flood_Prediction.ipynb. - This will train the model and save the
.joblibfiles into themodels/folder. - A ngrok Auth token is required, obtain your's and Run the file after adding it in .ipynb file.
- An ngrok streamlit based link will be generated, click on the link to show the streamlit app.
- Once generated, you can run the Streamlit app as described above.
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.
Python 3.8+
- Streamlit
- scikit-learn
- joblib
- pyngrok
Install everything with:
pip install -r requirements.txt