Ecosyste.ms: Awesome

An open API service indexing awesome lists of open source software.

Awesome Lists | Featured Topics | Projects

https://github.com/amine-akrout/mental_health_risk

Training and deploying LightGBM Model with MLFlow, fastapi, App Engine and github actions
https://github.com/amine-akrout/mental_health_risk

appengine ci-cd docker fastapi github-actions google-cloud machine-learning mlflow mlops pycaret python

Last synced: 1 day ago
JSON representation

Training and deploying LightGBM Model with MLFlow, fastapi, App Engine and github actions

Awesome Lists containing this project

README

        

# MLOps with MLflow, FastApi, App Engine and Github Actions
[![Deploy to App Engine](https://github.com/amine-akrout/mental_health_risk/actions/workflows/app_engine.yml/badge.svg)](https://github.com/amine-akrout/mental_health_risk/actions/workflows/app_engine.yml)
## Data Information
Data used in the project can be found on [UCI Machine Learning Repository](https://archive.ics.uci.edu/ml/datasets/Maternal+Health+Risk+Data+Set)

*Data has been collected from different hospitals, community clinics, maternal health cares from the rural areas of Bangladesh through the IoT based risk monitoring system.*

### Attribute Information:

- Age: Any ages in years when a women during pregnant.
- SystolicBP: Upper value of Blood Pressure in mmHg, another significant attribute during pregnancy.
- DiastolicBP: Lower value of Blood Pressure in mmHg, another significant attribute during pregnancy.
- BS: Blood glucose levels is in terms of a molar concentration, mmol/L.
- HeartRate: A normal resting heart rate in beats per minute.
- Risk Level: Predicted Risk Intensity Level during pregnancy considering the previous attribute.

## Workflow Architecture
![workflow_architecture](./demo/workflow_architecture.png)

## Requirements
* Python 3.8
* Docker
* Google Cloud Plateform account

## Quick Start
* Clone the repository


git clone https://github.com/amine-akrout/mental_health_risk

* Create a virtual and install requirements

python -m venv
pip install -r requirements.txt

* Train LightGBM using Pycaret and log metrics and artifacts with MLflow

python ./model.py

**MLflow experiment**
![demo_webapp](./demo/mlflow.JPG)

## Test locally
To test the web app locally using docker, start by building the image from the Dockerfile


docker build --pull --rm -f "Dockerfile" -t mentalhealthrisk:latest "."


docker run -p 8080:8080 mentalhealthrisk

the Web app should be runnining on http://localhost:8080/

## Deploy to Google Cloud App Engine


gcloud app deploy

## CI/CD workflow
Using Github actions and [app_engine.yml](https://github.com/amine-akrout/mental_health_risk/blob/master/.github/workflows/app_engine.yml), we could continuously deploy the web app by simply using the term "deploy" in the commit message when pushing to main branch

## Demo

![demo_webapp](./demo/webapp.gif)

## References:
* Data source: Marzia Ahmed, Email: [email protected]
Institution: Daffodil International University, Dhaka, Bangladesh.

* Deploy App Engine [Continuous deployment to Google App Engine using GitHub Actions](https://github.com/google-github-actions/deploy-appengine)