O'Reilly logo

Learning Salesforce Einstein by Mohith Shrivastava

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

The fileupload.js file

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 ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required