const AipOcrClient = require('baidu-aip-sdk').ocr

// 设置APPID/AK/SK
const APP_ID = '101474620'
const API_KEY = 'fqCvIHGisGwpsglzV2wdxZJ5'
const SECRET_KEY = 'RhTOXUA4V6CrGuCTJJvUQ7z6Nl4m0Lij'

// 新建一个对象，建议只保存一个对象调用服务接口
const client = new AipOcrClient(APP_ID, API_KEY, SECRET_KEY)

// 图片：6525
const imageBase64 = 'data:image/png;base64,[encoded data, 9104 characters]'

const options = {}
options.detect_direction = 'false'
options.paragraph = 'false'
options.probability = 'false'

// 调用通用文字识别（高精度版）（异步）
client.accurateBasic(imageBase64, options).then(function (result) {
  console.log(JSON.stringify(result))
}).catch(function (err) {
  // 如果发生网络错误
  console.log(err)
})
