Create a simple Machine Learning API to predict Employee Retention Use it as reference only!
- Create conda environment with taskfile command
task conda-create
- Activate the new created conda environment
conda activate <env_name |default: 2-flask-api>
task conda-install
task pip-install
- Create
.env
file in root folder with this specifications
Variables | Function | Example |
---|---|---|
PORT | your_API_port | 8081 |
MODEL_LAYER | your_model_layer_path | model/hdf5/v1/retention_prediction_model.json |
MODEL_WEIGHTS | your_model_weights_path | model/hdf5/v1/retention_prediction_weights.h5 |
STANDARD_SCALER | your_standard_scaler_path (opt) | model/hdf5/v1/standard_scaler.pkl |
- Create new docker image
task docker-build
- Run a new docker container
task docker-run
- Test the API with Postman. Import postman collection and environment and start the testing.
- If you encounter error below, run
sudo apt install python3-tk
ModuleNotFoundError: No module named 'tkinter'
[2] https://cloud.google.com/run/docs/quickstarts/build-and-deploy/deploy-python-service