Skip to content
This repository has been archived by the owner on Dec 17, 2021. It is now read-only.

Commit

Permalink
Update Flowers repository with new Buckets.
Browse files Browse the repository at this point in the history
Add GOOGLE_APPLICATION_CREDENTIALS definition
  • Loading branch information
gogasca committed Sep 18, 2018
1 parent dd76319 commit 90390bc
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 7 deletions.
2 changes: 1 addition & 1 deletion flowers/requirements.txt
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
apache-beam[gcp]==0.6.0
apache-beam[gcp]==2.6.0
pillow==4.0.0
tensorflow==1.4.1
10 changes: 5 additions & 5 deletions flowers/sample.sh
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ declare -r PROJECT=$(gcloud config list project --format "value(core.project)")
declare -r JOB_ID="flowers_${USER}_$(date +%Y%m%d_%H%M%S)"
declare -r BUCKET="gs://${PROJECT}-ml"
declare -r GCS_PATH="${BUCKET}/${USER}/${JOB_ID}"
declare -r DICT_FILE=gs://cloud-ml-data/img/flower_photos/dict.txt
declare -r DICT_FILE=gs://cloud-samples-data/ml-engine/flowers/dict.txt

declare -r MODEL_NAME=flowers
declare -r VERSION_NAME=v1
Expand All @@ -39,13 +39,13 @@ set -v -e
# CPU's. Check progress here: https://console.cloud.google.com/dataflow
python trainer/preprocess.py \
--input_dict "$DICT_FILE" \
--input_path "gs://cloud-ml-data/img/flower_photos/eval_set.csv" \
--input_path "gs://cloud-samples-data/ml-engine/flowers/eval_set.csv" \
--output_path "${GCS_PATH}/preproc/eval" \
--cloud

python trainer/preprocess.py \
--input_dict "$DICT_FILE" \
--input_path "gs://cloud-ml-data/img/flower_photos/train_set.csv" \
--input_path "gs://cloud-samples-data/ml-engine/flowers/train_set.csv" \
--output_path "${GCS_PATH}/preproc/train" \
--cloud

Expand Down Expand Up @@ -87,7 +87,7 @@ gcloud ml-engine versions set-default "$VERSION_NAME" --model "$MODEL_NAME"

# Finally, download a daisy and so we can test online prediction.
gsutil cp \
gs://cloud-ml-data/img/flower_photos/daisy/100080576_f52e8ee070_n.jpg \
gs://cloud-samples-data/ml-engine/flowers/daisy/100080576_f52e8ee070_n.jpg \
daisy.jpg

# Since the image is passed via JSON, we have to encode the JPEG string first.
Expand All @@ -99,4 +99,4 @@ python -c 'import base64, sys, json; img = base64.b64encode(open(sys.argv[1], "r
# service a moment to catch up--only needed when you deploy a new version.
# We wait for 10 minutes here, but often see the service start up sooner.
sleep 10m
gcloud ml-engine predict --model ${MODEL_NAME} --json-instances request.json
gcloud ml-engine predict --model ${MODEL_NAME} --json-instances request.json
6 changes: 5 additions & 1 deletion testing/ubuntu/setup_and_run_test.sh
Original file line number Diff line number Diff line change
Expand Up @@ -17,8 +17,12 @@ pip install --upgrade pip
# Install test requirements
pip install --upgrade -r $CMLE_REQUIREMENTS_FILE

export GOOGLE_APPLICATION_CREDENTIALS="${KOKORO_GFILE_DIR}/${CMLE_KEYFILE}"

gcloud auth activate-service-account --key-file "${KOKORO_GFILE_DIR}/${CMLE_KEYFILE}"
gcloud config set project $CMLE_PROJECT_ID
gcloud config set compute/region $CMLE_REGION
gcloud config list


bash $CMLE_TEST_SCRIPT
bash $CMLE_TEST_SCRIPT

0 comments on commit 90390bc

Please sign in to comment.