Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/mdh266/dockermlrestapi
Machine Learning App As REST API with Docker & Google Cloud Run
https://github.com/mdh266/dockermlrestapi
data-science docker flask google-cloud machine-learning rest-api xgboost
Last synced: about 2 months ago
JSON representation
Machine Learning App As REST API with Docker & Google Cloud Run
- Host: GitHub
- URL: https://github.com/mdh266/dockermlrestapi
- Owner: mdh266
- License: mit
- Created: 2020-05-26T02:59:19.000Z (over 4 years ago)
- Default Branch: master
- Last Pushed: 2020-06-07T18:15:28.000Z (over 4 years ago)
- Last Synced: 2024-06-11T17:53:59.263Z (8 months ago)
- Topics: data-science, docker, flask, google-cloud, machine-learning, rest-api, xgboost
- Language: Python
- Homepage:
- Size: 24.4 KB
- Stars: 0
- Watchers: 2
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# Dockerized Machine Learning Rest API
---------------------Example of turning an [XGBoost](http://xgboost.readthedocs.io/) model (built [here](https://github.com/mdh266/NYCBuildingEnergyUse)) using [Flask](https://flask.palletsprojects.com/en/1.1.x/), [Docker](https://www.docker.com/) and [Google Cloud Run](https://cloud.google.com/run).
## Local Use
---------------Build the image
docker build -t mlapp app
Run the API locally:
docker run -ip 8080:8080 mlappFrom Python:
data = {'columns': ['Energy_Star', 'Site_EUI', 'NGI', 'EI', 'Residential'],
'data': [[7744, 52.7, 45.9641802469, 10.1204555556, 1],
[9, 112.2, 25.9187489356, 29.7707095517, 1]]}import requests
result = requests.post(url="http://0.0.0.0:8080/predict",
json=data)result.json() # [0.0031427741050720215, 0.007205158472061157]
## Deploying to Google Cloud Run:
------------------------
Build image on Google Cloud:cd app
gcloud builds submit --tag gcr.io//mlapp
Deploy to Google Cloud Run:
gcloud run deploy --image gcr.io//mlapp --platform managed