Skip to content

Food Classifier App using TensorFlow 2, Google Cloud Run

Notifications You must be signed in to change notification settings

vikivivi/food_classifier_tf2_cloud_run

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

18 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Food Classifier App with TensorFlow 2 model on Google Cloud Run

This repo contains a web app for classifying 3 types of local Singaporean Food using the following APIs and platforms

  • TensorFlow 2: using tf.image, tf.keras.models and tf.data (for training)
  • Google Cloud Platform: Cloud Run, Cloud Build, Cloud Storage
  • Starlette, a lightweight ASGI framework/toolkit

Deploy with Google Cloud Run

Pre-requisites

  • Google Cloud Account
  • Enable Cloud Run and Cloud Build API

Deploy

To run the webapp on Google Cloud Run, launch Cloud Shell from your Dashboard.

  • export PROJECT_ID={your project id here}
  • Run gcloud config set project $PROJECT_ID
  • Run git clone https://github.com/yoke2/food_classifier_tf2_cloud_run.git
  • Change directory: cd food_classififer_tf2_cloud_run
  • Build container image with Google Cloud Build by running gcloud builds submit --tag gcr.io/$PROJECT_ID/food_classifier
    • If prompted that Cloud Build API not enabled on the project, enter 'y' to enable and retry
  • Deploy container built: gcloud run deploy --image gcr.io/$PROJECT_ID/food_classifier --platform managed --allow-unauthenticated --memory 1024M
    • You will be prompted for the service name: press Enter to accept the default name
    • You will be prompted for region: select the region us-central1
  • You will receive an URL to access the app. This can be seen on the Cloud Run page for dimsumapp in the Dashboard as well

Docker Installation

You can test your changes locally by installing Docker and using the following command:

docker build -t food-tf2-cr . && docker run --rm -it -p 8080:8080 food-tf2-cr

Local Installation

  • Install dependencies
$ pip install packaging
$ pip install -r requirements.txt

Run app

$ python app/server.py serve

Reference

About

Food Classifier App using TensorFlow 2, Google Cloud Run

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

  • Python 38.9%
  • HTML 21.1%
  • JavaScript 19.1%
  • CSS 15.2%
  • Dockerfile 5.7%