Giter Site home page Giter Site logo

krzhalovski / cloudrun-tensorflow-prediction Goto Github PK

View Code? Open in Web Editor NEW

This project forked from guillaumeblaquiere/cloudrun-tensorflow-prediction

0.0 1.0 0.0 10 KB

Build a Cloud Run compliant container for serving tensorflow prediction model

License: Apache License 2.0

Dockerfile 100.00%

cloudrun-tensorflow-prediction's Introduction

Overview

Example of build of a Cloud Run compliant container for serving tensorflow prediction model.

Build the container

You have to retrieve your tensorflow model from Google Cloud Storage. Either update _EXPORT_BUCKET default value in the cloudbuild.yaml file and run this command

gcloud builds submit

Or simply override the variable from command line

gcloud builds submit --substitutions=_EXPORT_BUCKET=gs://path/to/my/models

Deploy on Cloud Run

Deploy on your project (update PROJECT_ID in the following command)

gcloud beta deploy predict --image gcr.io/<PROJECT_ID>/predict

Test your model deployment

Create a file with the required inputs for your models. Here an example for my models in file instances.json. File can contain up to 100 instances.

Then call your Cloud Run deployment with this input file (replace the hash with your Cloud Run URL)

curl -X "content-type: application/json" -X POST \
    -d @instances.json https://predict-<hash>.run.app/v1/models/default:predict

Deployment optimization

For optimizing the deployment, you can factorize the common things between each deployment. Here it's the Tensorflow installation.

Start by creating your own version

gcloud builds submit --config cloudbuild-base.yaml

Then, for all your package and deployment, use the previous image as base image in your docker file. Don't forger to change the projectid in the Dockerfile.optim file

gcloud builds submit --config cloudbuildanddeploy-optim.yaml

License

This repository is licensed under Apache 2.0. Full license text is available in LICENSE.

cloudrun-tensorflow-prediction's People

Contributors

guillaumeblaquiere avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.