When a file is dropped on to the dropzone UI, we invoke the file-upload function. Copy paste the code from the file at https://github.com/PacktPublishing/Learning-Salesforce-Einstein/blob/master/Chapter5/EinsteinVision/middleware-api/file-upload.js:
function fileUpload(request, response, next) { const filePath = request.files.file.path; const fileExt = path.extname(filePath).replace(/^./,''); const modelId = process.env.CUSTOM_MODEL_ID; const pvsUrl = process.env.EINSTEIN_VISION_URL || 'https://api.metamind.io/'; const accountId = process.env.EINSTEIN_VISION_ACCOUNT_ID || 'msrivastav13@gmail.com'; const privateKey = process.env.EINSTEIN_VISION_PRIVATE_KEY || fs.readFileSync(__dirname +'/key.pm','utf8'); const jwtToken ...