Dim Sum Image Classification App with fast.ai models on Google Cloud Run
This repo contains a version of the web app for classifying dim sum that can be deployed to Google Cloud Run. It supports 5 dim sum types currently.
- Google Cloud Account
- Enable Cloud Run and Cloud Build API
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/dimsum_classifier_fastai_cloud_run.git
- Change directory:
cd dimsum_classifier_fastai_cloud_run
- Build container image with Google Cloud Build by running
gcloud builds submit --tag gcr.io/$PROJECT_ID/dimsumapp
- 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/dimsumapp --platform managed --allow-unauthenticated --memory 512M
- 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
You can test your changes locally by installing Docker and using the following command:
docker build -t dimsum-fastai-v3-cr . && docker run --rm -it -p 5000:5000 dimsum-fastai-v3-cr
- Install dependencies
$ pip install -r requirements.txt
$ python app/server.py serve