@adncorp/parse-server-ml-adapter

AD

Usage no npm install needed!

<script type="module">
  import adncorpParseServerMlAdapter from 'https://cdn.skypack.dev/@adncorp/parse-server-ml-adapter';
</script>

README

BeConnect Sync Adapter

JavaScript Style Guide

Get started

Parse server adapter for ML based on some Cloud ML provider like Microsoft, Google and Amazon

Usage

1- first create a cognitive Service Account the link with the instructions : https://docs.microsoft.com/fr-fr/azure/cognitive-services/cognitive-services-apis-create-account?tabs=multiservice%2Cwindows

2- Install and configure the adapter on you parse-server app

$npm install --save  @adncorp/parse-server-ml-adapter
const ParseServerMlAdapter = require('@adncorp/parse-server-ml-adapter').default;
// or if you are using es6
import ParseServerMlAdapte from  '@adncorp/parse-server-ml-adapter';

// register 
const providersConfigs = {
    microsoft: {
        subscriptionKey: "COMPUTER_VISION_SUBSCRIPTION_KEY",
        endpoint: "COMPUTER_VISION_ENDPOINT"
    },
    tesseract: {
        key: process.env.TES_KEY,
        endpoint: process.env.TES_ENDPOINT
    },
    tabscanner:{
        apikey:process.env.TABSCANNER_APIKEY,
        endpoint: process.env.TABSCANNER_ENDPOINT
    }
};

const parseServerMlAdapter = new ParseServerMlAdapter(providersConfigs);

var parseApi = new ParseServer({
    ...
    machineLearningAdapter = parseServerMlAdapter
});

// you can you it with you express app as usual

3- To test you can ocr recognition from Microsoft computer vision ocr service

curl --request POST \
  --url http://localhost:1337/parse/predict/microsoft \
  --header 'accept: application/json' \
  --header 'content-type: application/json' \
  --header 'x-parse-application-id: myappid' \
  --header 'x-parse-rest-api-key: restapiKey' \
  --data '{"service": "ocr","data":{"url": "https://upload.wikimedia.org/wikipedia/commons/thumb/a/af/Atomist_quote_from_Democritus.png/338px-Atomist_quote_from_Democritus.png","params": {"language": "unk","detectOrientation": true}}}'

the result should be

{text : 'NOTHING\nEXISTS\nEXCEPT\nATOMS\nAND EMPTY\nSPACE.\nEverything else\nis opinion.'}

Requirement

  • node >= 10.x

Developer

  • install deps
npm install
  • run unit tests
npm run coverage

Command line

npm build 
node bin/parse-server-ml-adapter --help