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
}
]
}
{
"status": "200",
"message": "success",
,
"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
}
]
}
{
"detail": [
{
"loc": [
"string"
],
"msg": "string",
"type": "string"
}
]
}
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())
const axios = require("axios");
const api = "https://apis.aigen.online/aiscript/general-ocr/v1";
const headers = {
"x-aigen-key": "<key>",
};
const data = { image: "<base64_string>" };
axios
.post(api, data, { headers: headers })
.then((res) => {
console.log(res.data);
})
.catch((err) => {
console.error(err.response.data);
});
Last updated