File size: 3,720 Bytes
7b2177e
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "$id": "https://huggingface.co/bodhan-ai/indic-doc-parser/raw/main/schemas/layout_output.schema.json",
  "title": "Layout JSON (stage-1 output, stage-2 input)",
  "description": "Blocks carry no 'text' key. Absence means not transcribed yet, which is distinct from text: \"\" in a parsed page.",
  "type": "object",
  "required": [
    "image",
    "width",
    "height",
    "blocks"
  ],
  "properties": {
    "image": {
      "type": "string"
    },
    "width": {
      "type": "integer",
      "exclusiveMinimum": 0
    },
    "height": {
      "type": "integer",
      "exclusiveMinimum": 0
    },
    "blocks": {
      "type": "array",
      "items": {
        "$ref": "#/$defs/block"
      }
    }
  },
  "$defs": {
    "block": {
      "type": "object",
      "required": [
        "order",
        "bbox_xyxy"
      ],
      "properties": {
        "order": {
          "type": "integer",
          "minimum": 0,
          "description": "Reading-order rank. Gap-free and 0-based across the page."
        },
        "label": {
          "type": "string",
          "description": "IndicDocLayout class. Restricted to the taxonomy unless 'type' is given."
        },
        "type": {
          "type": "string",
          "enum": [
            "Text",
            "Title",
            "SectionHeader",
            "Table",
            "Equation",
            "Caption",
            "Footnote",
            "PageHeader",
            "PageFooter",
            "PageNumber",
            "Figure",
            "Picture"
          ],
          "description": "Pipeline category; selects the prompt. Derived from 'label' when omitted."
        },
        "bbox_xyxy": {
          "type": "array",
          "items": {
            "type": "number"
          },
          "minItems": 4,
          "maxItems": 4,
          "description": "Pixel [x0, y0, x1, y1], clamped to the page."
        },
        "conf": {
          "type": "number",
          "minimum": 0,
          "maximum": 1
        }
      },
      "allOf": [
        {
          "if": {
            "not": {
              "required": [
                "type"
              ]
            }
          },
          "then": {
            "required": [
              "label"
            ],
            "properties": {
              "label": {
                "enum": [
                  "Question",
                  "Paragraph",
                  "Answer",
                  "List",
                  "Title",
                  "Section-title",
                  "Equation",
                  "Table",
                  "Diagram",
                  "Image",
                  "MCQ",
                  "Infobox",
                  "Sub-section-title",
                  "Expression",
                  "Image-caption",
                  "Placeholder-text",
                  "Chart",
                  "Solved-example",
                  "Footnote",
                  "Table-caption",
                  "Sub-sub-section-title",
                  "Footer",
                  "Header",
                  "Code",
                  "Page-number",
                  "Chapter-title",
                  "Chapter-end-section",
                  "Folio",
                  "Reference",
                  "Table-of-contents",
                  "Index",
                  "Advertisement",
                  "Author",
                  "Dateline",
                  "Contact-info",
                  "Website-link",
                  "Flag"
                ]
              }
            }
          }
        }
      ],
      "not": {
        "required": [
          "text"
        ]
      }
    }
  }
}