Skip to content

p2k3/water-quality-api

Repository files navigation

Water Quality Monitoring API

This project is a FastAPI application for monitoring water quality using a machine learning model. The application provides an API that allows users to submit water quality data and receive predictions regarding the quality of the water.

Project Structure

water-quality-api
├── app
│   ├── __init__.py          # Initializes the app package
│   ├── main.py              # Entry point of the API
│   ├── schemas.py           # Data models for request and response validation
│   └── predictor.py         # Logic for loading the model and making predictions
├── models
│   └── water_quality_model.pkl # Saved machine learning model
├── .gitignore                # Files and directories to ignore by Git
├── Dockerfile                # Instructions for building the Docker image
├── Procfile                  # Command to run the application on Render
├── README.md                 # Documentation for the project
└── requirements.txt          # Python dependencies for the project

Setup Instructions

  1. Clone the repository:

    git clone <repository-url>
    cd water-quality-api
  2. Create a virtual environment:

    python -m venv venv
    source venv/bin/activate  # On Windows use `venv\Scripts\activate`
  3. Install the required dependencies:

    pip install -r requirements.txt
  4. Run the application:

    uvicorn app.main:app --reload

Usage

Once the application is running, you can access the API at http://localhost:8000. The API provides endpoints for submitting water quality data and receiving predictions.

Example Request

To get a prediction, send a POST request to the /predict endpoint with the required data in JSON format.

{
  "parameter1": value1,
  "parameter2": value2,
  ...
}

Example Response

The API will return a JSON response with the prediction result.

{
  "prediction": "safe",
  "confidence": 0.95
}

License

This project is licensed under the MIT License. See the LICENSE file for more details.

About

water quality api for SymGAT model

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors