Skip to content

Commit

Permalink
layout-analysis doc
Browse files Browse the repository at this point in the history
  • Loading branch information
xiaotinghe committed Mar 14, 2024
1 parent 7b90e40 commit 8c45fe5
Showing 1 changed file with 42 additions and 34 deletions.
76 changes: 42 additions & 34 deletions docs/en/deploy-layout-analysis.md
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,8 @@ include "include-deploy-description.md"
|----------|-----------|------------|------------|
| url | *String* |Choose url or img.| Image URL address, which supports HTTP/HTTPS and S3 protocols. Supported image formats are jpg/jpeg/png/bmp, with the longest side not exceeding 4096px.|
| img | *String* |Choose url or img.|Base64 encoded image data.|
| output_type | *String* | |`json` or `markdown`, Whether the result is returned in json or converted to markdown.|
| table_type | *String* | |`html` or `markdown`, Whether the table in the result is returned in html or converted to markdown.|

- Example Request

Expand Down Expand Up @@ -58,56 +60,62 @@ include "include-deploy-description.md"

- Response parameters

When `output_type` is `json`, a list is returned, and an item in the list is a block in a document.

| **Name** | **Type** | **Description** |
|----------|-----------|------------|
|words |*String* |Recognized text.|
|location |*JSON* |Coordinates of the recognized text, including top, left, width, height as integer values.|
|score |*Float* |Confidence score of the recognized text, which is a float type value between 0 and 1.|

- Example JSON response
|BlockType |*String* |These elements correspond to the different portions of the layout, and are: text, title, figure or table|
|location |*Dict* |location information about the location of detected items on a document page.|
|Text |*String* |The text content of the current block. When BlockType is `table`, the html or markdown of the table will be returned depending on the `table_type`.|

**Example 1 Response**
When `output_type` is `markdown`, a dict is returned.

Assume the model returns the category of the "unclassified text" as "sports."

``` json
{
"url": "{{page.meta.sample_image}}"
}
```
| **Name** | **Type** | **Description** |
|----------|-----------|------------|
|markdown |*String* |Converted images to markdown result.|

``` json
{
"img": "Base64-encoded image data"
}
- Example JSON response

**Example 2 Response**
**Example 1 `output_type` is `json` response**

``` json
[
{
"words": "香港永久性居民身份證",
"location": {
"top": 18,
"left": 148,
"width": 169,
"height": 17
},
"score": 0.9923796653747559
"BlockType": "text",
"Geometry": {
"BoundingBox": {
"Width": 972,
"Height": 79,
"Left": 561,
"Top": 564
}
},
"Text": "核准日期:xxx年xx月xx日"
},
{
"words": "HONG KONG PERMANENTIDENTITYCARD",
"location": {
"top": 36,
"left": 71,
"width": 321,
"height": 17
},
"score": 0.9825196266174316
"BlockType": "text",
"Geometry": {
"BoundingBox": {
"Width": 1543,
"Height": 80,
"Left": 569,
"Top": 678
}
},
"Text": "修改日期:xxx年xx月xx日"
}
...
]
```

**Example 2 `output_type` is `markdown` response**

``` json
{
"Markdown": "核准日期:xxx年xx月xx日 \n\n修改日期:xxx年xx月xx日...."
}
```

{%
include-markdown "include-deploy-code.md"
%}
Expand Down

0 comments on commit 8c45fe5

Please sign in to comment.