General OCR

​Extract text from an image.

Extract text from an image

POST https://apis.aigen.online/aiscript/general-ocr/v1

Request Body

Name
Type
Description

image*

String

Full page of image,pdf endcoded as base64 utf8 (support pdf base64 multiple pages)

{
  "status": "200",
  "message": "success",
  "response_id": "string",
  "error_list": [
    {
      "code": "string",
      "message": "string"
    }
  ],
  "result": [
    {
      "boxs": [
        {
          "bbox": [
            [
              0,
              0
            ],
            [
              50,
              0
            ],
            [
              50,
              50
            ],
            [
              0,
              50
            ]
          ],
          "char_pos": [
            0,
            5,
            10
          ],
          "text": "548 9",
          "confidence": 0.99875
        }
      ],
      "text_page": "123 abc\n",
      "page": 1,
      "max_page": 5
    }
  ]
}

​Example code

import requests
import json

api = "https://apis.aigen.online/aiscript/general-ocr/v1"
headers = {"x-aigen-key": "<key>"}
data = {"image": "<base64_string>"}

res = requests.post(api, json=data, headers=headers)
print(res.json())

Last updated