Skip to content

This API is built using FastAPI to predict flood risks based on various environmental and infrastructural factors. The model used for prediction is loaded from a pickle file and uses features like Monsoon Intensity, Urbanization, Climate Change, and more.

Notifications You must be signed in to change notification settings

Viku69/FloodAPI

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

9 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Live Webservice

Flood Risk Prediction API

This API is built using FastAPI to predict flood risks based on various environmental and infrastructural factors. The model used for prediction is loaded from a pickle file and uses features like Monsoon Intensity, Urbanization, Climate Change, and more.

Features

  • Load a pre-trained model from a specified path.
  • Predict flood risk based on input data with 20 different features.
  • Structured logging for better tracking and debugging.
  • CORS support for local development and external connections.

Getting Started

Prerequisites

Ensure you have the following installed:

  • Python 3.7+
  • FastAPI
  • Uvicorn
  • Pydantic
  • Pandas
  • Pickle
  • Python-dotenv

Installation

  1. Clone the repository:

    git clone https://github.com/yourusername/flood-risk-prediction-api.git
    cd flood-risk-prediction-api
  2. Install dependencies:

    pip install -r requirements.txt
  3. Create a .env file in the root directory and add the following environment variables:

    MODEL_PATH=path/to/your/FloodRisk.pkl
    HOST=127.0.0.1
    PORT=8000
  4. Place your trained model (e.g., FloodRisk.pkl) in the specified path or update the MODEL_PATH in the .env file.

Running the API

Run the API using Uvicorn:

uvicorn main:app --reload

About

This API is built using FastAPI to predict flood risks based on various environmental and infrastructural factors. The model used for prediction is loaded from a pickle file and uses features like Monsoon Intensity, Urbanization, Climate Change, and more.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published