This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
{ | |
"responses": [ | |
{ | |
"faceAnnotations": [ | |
{ | |
"boundingPoly": { | |
"vertices": [ | |
{ | |
"x": 669, | |
"y": 324 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
{ | |
"responses": [ | |
{ | |
"webDetection": { | |
"webEntities": [ | |
{ | |
"entityId": "/m/0105pbj4", | |
"score": 0.8895, | |
"description": "Google Cloud Platform" | |
}, |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
{ | |
"requests": [ | |
{ | |
"image": { | |
"source": { | |
"gcsImageUri": "gs://[你的bucket名稱]/selfie.png" | |
} | |
}, | |
"features": [ | |
{ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
{ | |
"requests": [ | |
{ | |
"image": { | |
"source": { | |
"gcsImageUri": "gs://[你的bucket名稱]/donuts.png" | |
} | |
}, | |
"features": [ | |
{ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
{ | |
"requests": [ | |
{ | |
"image": { | |
"source": { | |
"gcsImageUri": "gs://[你的bucket名稱]/donuts.png" | |
} | |
}, | |
"features": [ | |
{ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# 取得專案ID | |
export PROJECT_ID=$(gcloud info --format='value(config.project)') | |
# Cloud Storage buckets的名稱,格式為[你的專案ID]-upload | |
export BUCKET_NAME=${PROJECT_ID}-upload | |
# 建立Bucket | |
gsutil mb gs://${BUCKET_NAME} | |
# 檢查一下Bucket是否成功建立 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# 部置GCStoPubsub function | |
gcloud beta functions deploy GCStoPubsub --stage-bucket gs://${STAGING_BUCKET_NAME} --trigger-topic ${UPLOAD_NOTIFICATION_TOPIC} --entry-point GCStoPubsub --runtime=nodejs6 | |
# 部置visionAPI function | |
gcloud beta functions deploy visionAPI --stage-bucket gs://${STAGING_BUCKET_NAME} --trigger-topic visionapiservice --entry-point visionAPI --runtime=nodejs6 | |
# 部置videoIntelligenceAPI function | |
gcloud beta functions deploy videoIntelligenceAPI --stage-bucket gs://${STAGING_BUCKET_NAME} --trigger-topic videointelligenceservice --entry-point videoIntelligenceAPI --timeout 540 --runtime=nodejs6 | |
# 部置insertIntoBigQuery function |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
sed -i "s/\[PROJECT-ID\]/$PROJECT_ID/g" config.json | |
sed -i "s/\[FLAGGED_BUCKET_NAME\]/$FLAGGED_BUCKET_NAME/g" config.json | |
sed -i "s/\[FILTERED_BUCKET_NAME\]/$FILTERED_BUCKET_NAME/g" config.json | |
sed -i "s/\[DATASET_ID\]/$DATASET_ID/g" config.json | |
sed -i "s/\[TABLE_NAME\]/$TABLE_NAME/g" config.json |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# 取得專案ID | |
export PROJECT_ID=$(gcloud info --format='value(config.project)') | |
# Cloud Storage buckets的名稱 | |
export IV_BUCKET_NAME=${PROJECT_ID}-upload | |
export FILTERED_BUCKET_NAME=${PROJECT_ID}-filtered | |
export FLAGGED_BUCKET_NAME=${PROJECT_ID}-flagged | |
export STAGING_BUCKET_NAME=${PROJECT_ID}-staging | |
# Cloud Pub/Sub topic環境變數 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# 建立4個不同用途的Topics | |
gcloud pubsub topics create ${UPLOAD_NOTIFICATION_TOPIC} | |
gcloud pubsub topics create visionapiservice | |
gcloud pubsub topics create videointelligenceservice | |
gcloud pubsub topics create bqinsert | |
# 檢查Topics是否正確被建立 | |
gcloud pubsub topics list |