| 25 | const vision = require('@google-cloud/vision'); |
| 26 | |
| 27 | async function setEndpoint() { |
| 28 | // Specifies the location of the api endpoint |
| 29 | const clientOptions = {apiEndpoint: 'eu-vision.googleapis.com'}; |
| 30 | |
| 31 | // Creates a client |
| 32 | const client = new vision.ImageAnnotatorClient(clientOptions); |
| 33 | |
| 34 | // Performs text detection on the image file |
| 35 | const [result] = await client.textDetection('./resources/wakeupcat.jpg'); |
| 36 | const labels = result.textAnnotations; |
| 37 | console.log('Text:'); |
| 38 | labels.forEach(label => console.log(label.description)); |
| 39 | } |
| 40 | setEndpoint(); |
| 41 | // [END vision_set_endpoint] |
| 42 | } |