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.
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
-
Clone the repository:
git clone <repository-url> cd water-quality-api
-
Create a virtual environment:
python -m venv venv source venv/bin/activate # On Windows use `venv\Scripts\activate`
-
Install the required dependencies:
pip install -r requirements.txt
-
Run the application:
uvicorn app.main:app --reload
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.
To get a prediction, send a POST request to the /predict endpoint with the required data in JSON format.
{
"parameter1": value1,
"parameter2": value2,
...
}The API will return a JSON response with the prediction result.
{
"prediction": "safe",
"confidence": 0.95
}This project is licensed under the MIT License. See the LICENSE file for more details.