OCR Text
Create the task with the createTask interface to recognize text from images using OCR
WARNING
Create the task with the createTask.
This interface does not need to obtain the results separately, will directly return the image recognition results!
The task type field is as follows
ai.ocr.text
Create Task
Create the task with the createTask.
Task Object Structure
Note that this type of task returns the task execution result directly after createTask, rather than getting it asynchronously through getTaskResult.
| Properties | Type | Required | Description |
|---|---|---|---|
| service | String | Required | ai.ocr.text |
| websiteURL | String | Optional | Page source url to improve accuracy |
| body | String | Required | base64 encoded content of the image (no newlines, no data:image/***;charset=utf-8;base64,) |
| images | List[string] | Optional | Only for number module, Support up to 9 base64 encoded images each time |
| module | String | Optional | Specifies the module. All supported models are shown in the table below |
Independent module support
| Module | Questions | Samples | Accuracy | LastUpdate |
|---|
Example Request
POST https://api.pixelant.ai/api/v1/createTask
Host: api.pixelant.ai
Content-Type: application/json
x-api-key: sk_0cqyZoycFci4eIQnQSgucyCTkZU...W31wLlefAt9IF2tn1YFV0{
"service": "ai.ocr.text",
"input": {
"websiteURL": "https://xxxx.com",
// You can choose the module you need to use
// ocr single image model, default common
"module": "common",
// base64 encoded image
"body": "/9j/4AAQSkZJRgABA......"
}
}If there are only numbers in the picture, it's recommended that you use the number module. Example Request:
{
"service": "ai.ocr.text",
"input": {
"websiteURL": "https://xxxx.com",
"module": "number",
// Put up to 9 images
"images": [
"/9j/4AAQSkZJRgABAQA...",
"/9j/4AAQSkZJRgABAQA...",
"/9j/4AAQSkZJRgABAQA...",
"/9j/4AAQSkZJRgABAQA...",
"/9j/4AAQSkZJRgABAQA...",
"/9j/4AAQSkZJRgABAQA...",
"/9j/4AAQSkZJRgABAQA...",
"/9j/4AAQSkZJRgABAQA...",
"/9j/4AAQSkZJRgABAQA..."
]
}
}Example Response
{
"errorId": 0,
"errorCode": "",
"errorDescription": "",
"status": "ready",
"solution": {
"text": "44795sds",
// number module:
"answers": ["100", "1330", "147", "248", "303", "439", "752", "752", "752"],
},
"taskId": "..."
}Last updated on