-
Notifications
You must be signed in to change notification settings - Fork 361
/
Analyze Images with the Cloud Vision API: Challenge Lab
65 lines (48 loc) · 1.46 KB
/
Analyze Images with the Cloud Vision API: Challenge Lab
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
export REGION=
export API_KEY=
gcloud config set compute/region $REGION
gsutil acl ch -u AllUsers:R gs://$DEVSHELL_PROJECT_ID-bucket/manif-des-sans-papiers.jpg
sleep 20
cat > request.json <<EOF
{
"requests": [
{
"image": {
"source": {
"gcsImageUri": "gs://$DEVSHELL_PROJECT_ID-bucket/manif-des-sans-papiers.jpg"
}
},
"features": [
{
"type": "TEXT_DETECTION",
"maxResults": 10
}
]
}
]
}
EOF
curl -s -X POST -H "Content-Type: application/json" --data-binary @request.json https://vision.googleapis.com/v1/images:annotate?key=${API_KEY}
curl -s -X POST -H "Content-Type: application/json" --data-binary @request.json https://vision.googleapis.com/v1/images:annotate?key=${API_KEY} -o text-response.json
gsutil cp text-response.json gs://$DEVSHELL_PROJECT_ID-bucket
cat > request.json <<EOF
{
"requests": [
{
"image": {
"source": {
"gcsImageUri": "gs://$DEVSHELL_PROJECT_ID-bucket/manif-des-sans-papiers.jpg"
}
},
"features": [
{
"type": "LANDMARK_DETECTION",
"maxResults": 10
}
]
}
]
}
EOF
curl -s -X POST -H "Content-Type: application/json" --data-binary @request.json https://vision.googleapis.com/v1/images:annotate?key=${API_KEY} -o landmark-response.json
gsutil cp landmark-response.json gs://$DEVSHELL_PROJECT_ID-bucket