Skip to content
This repository was archived by the owner on Nov 15, 2024. It is now read-only.

Repository files navigation

WaterWise ML Service

This is the REST API service for the machine learning models for the WaterWise project.

Endpoints

  • POST /water-segmentation: Segment/extract the water from the image. Returns an image.
  • POST /clean-water: Predict if the water is clean or not. Returns a float value from 0 to 1. Values above 0.5 indicate clean water.
  • POST /clean-water/with-extraction: Predict if the water is clean or not and extract the water from the image. Returns a float value from 0 to 1. Values above 0.5 indicate clean water.
  • POST /potability-iot: Predict if the water is drinkable or not (potability). Returns either 0 or 1. 1 indicate clean water.

Usage

Prepare the models. Place the models in the models folder.

wget "https://example.com/models/clean-water.h5" -O "clean-water.h5"
wget "https://example.com/models/water-segmentation.pth" -O "water-segmentation.pth"
wget "https://example.com/models/potability-iot.h5" -O "potability-iot.h5"

Install the required packages using pip.

pip install -r requirements.txt

Run the service.

python main.py

The service will be running on http://localhost:5000.

Deployment

The service can be deployed using Docker. Build the Docker image.

docker build -t ml-service .

Run the Docker container.

docker run -p 5000:5000 ml-service

Docker Compose can also be used.

docker compose up --build

You can also use Buildpacks to deploy the service to Google Cloud.

gcloud builds submit --pack image=gcr.io/PROJECT_ID/ml-service
# run it on Google Cloud Run
gcloud run deploy --image gcr.io/PROJECT_ID/ml-service

About

Backend service for machine learning models of WaterWise

Topics

Resources

Stars

0 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages