In our project we use Cloud Shell to create two buckets:
- To create the first bucket:
$ gsutil mb gs://[OUR-PROJECT-ID]
- The second bucket:
$ gsutil mb gs://[OUR-PROJECT-ID]-tf2-models
We use AI Platform (Models) to deploy our model in GCP.
The steps to deploy the model to the AI Platform is:
- Click Navigation Menu -> AI Platform
- Select Models
- Click [+] New Models button.
- Fill the name model as 'waste', then select the region, after that click Create
- Return to Models menu, click 'waste' model.
- Click [+] New Version button.
- Fill the version name as 'v1', and fill the Pre-built container settings with:
- Click Save and wait until versioning done.
With App Engine (Standard) we deploy the web version of our product.
The steps to deploy is:
-
Open Cloud Shell, then type commands below:
$ mkdir wep-app $ cd wep-app $ git clone https://github.com/HiWaste/web-app.git $ cd wep-app
-
Create two files: app.yaml and main.py, using commands:
$ sudo touch app.yaml $ sudo touch main.py
-
In root project:
$ cd hiwaste_web $ sudo vim settings.py
-
In settings.py, search ALLOWED_HOST = [], then chage as:
ALLOWED_HOST = ["*"]
Save settings.py.
-
Return to root project:
$ cd ..
-
Test the web before deploy, with steps:
$ virtualenv env $ source env/bin/activate $ pip install -r requirements.txt
Wait until the dependencies is installed, then type:
$ python3 manage.py runserver
Click web preview on Cloud Shell, change port with: 8000, then click Change and Preview. If the web running as well it's time to deploy!
-
Deploy time!
Press Ctrl + C to stop web preview and then type:
$ gcloud app deploy
And select the region and wait until done.
-
Result: https://cosmic-quarter-312712.et.r.appspot.com/product/3