I'd like to use Google cloud vision API. I copied the code but I'm getting the following error : SyntaxError: await is only valid in async function.
const vision = require('@google-cloud/vision');
// Creates a client
const client = new vision.ImageAnnotatorClient();
/**
* TODO(developer): Uncomment the following line before running the sample.
*/
const fileName = '/Tickets/leclerc.jpg';
// Performs text detection on the local file
const [result] = await client.textDetection(fileName);
const detections = result.textAnnotations;
console.log('Text:');
detections.forEach(text => console.log(text));
Any ideas on how to solve it ?
Thanks a lot