| 22 | function main() { |
| 23 | // [START vision_quickstart] |
| 24 | async function quickstart() { |
| 25 | // Imports the Google Cloud client library |
| 26 | const vision = require('@google-cloud/vision'); |
| 27 | |
| 28 | // Creates a client |
| 29 | const client = new vision.ImageAnnotatorClient(); |
| 30 | |
| 31 | // Performs label detection on the image file |
| 32 | const [result] = await client.labelDetection('./resources/wakeupcat.jpg'); |
| 33 | const labels = result.labelAnnotations; |
| 34 | console.log('Labels:'); |
| 35 | labels.forEach(label => console.log(label.description)); |
| 36 | } |
| 37 | quickstart(); |
| 38 | // [END vision_quickstart] |
| 39 | } |