GCP console 명령
gcloud config set project qwiklabs-gcp-00-acf9d7b837de
export GOOGLE_CLOUD_PROJECT=$(gcloud config get-value core/project)
gcloud iam service-accounts create my-natlang-sa \
--display-name "my natural language service account"
gcloud iam service-accounts keys create ~/key.json \
--iam-account my-natlang-sa@${GOOGLE_CLOUD_PROJECT}.iam.gserviceaccount.com
gcloud compute ssh [INSTANCE_NAME] --zone=[ZONE]
gcloud compute ssh linux-instance --zone=us-east4-b
gcloud ml language analyze-entities --content="Michelangelo Caravaggio, Italian painter, is known for 'The Calling of Saint Matthew'." > result.json
export API_KEY=<YOUR_API_KEY>
export API_KEY=AIzaSyCO4c7jJCH-ZaMGAld9KLbLUBbrVgpsauI
touch request.json
nano request.json
{
"config": {
"encoding":"FLAC",
"languageCode": "en-US"
},
"audio": {
"uri":"gs://cloud-samples-tests/speech/brooklyn.flac"
}
}
curl -s -X POST -H "Content-Type: application/json" --data-binary @request.json \
"https://speech.googleapis.com/v1/speech:recognize?key=${API_KEY}"
curl -s -X POST -H "Content-Type: application/json" --data-binary @request.json \
"https://speech.googleapis.com/v1/speech:recognize?key=${API_KEY}" > result.json
ML
gcloud ml language analyze-entities --content="Old Norse texts portray Odin as one-eyed and long-bearded, frequently wielding a spear named Gungnir and wearing a cloak and a broad hat." > result.json
gcloud projects add-iam-policy-binding $(gcloud config get-value core/project) \
--member=serviceAccount:quickstart@qwiklabs-gcp-04-0cfa63708499.iam.gserviceaccount.com \
--role=roles/storage.objectAdmin
IAM Service
gcloud iam service-accounts create quickstart
gcloud iam service-accounts keys create key.json --iam-account quickstart@$(gcloud config get-value core/project).iam.gserviceaccount.com
gcloud auth activate-service-account --key-file key.json
gcloud auth print-access-token
nano request.json
{
"inputUri":"gs://spls/gsp154/video/train.mp4",
"features": [
"LABEL_DETECTION"
]
}
curl -s -H 'Content-Type: application/json' \
-H 'Authorization: Bearer '$(gcloud auth print-access-token)'' \
'https://videointelligence.googleapis.com/v1/videos:annotate' \
-d @request.json
curl -s -H 'Content-Type: application/json' \
-H 'Authorization: Bearer '$(gcloud auth print-access-token)'' \
'https://videointelligence.googleapis.com/v1/projects/214805696565/locations/asia-east1/operations/16538445285955914847'