File size: 5,976 Bytes
fea5887
 
 
916a818
fea5887
d2fe18e
fea5887
 
 
916a818
fea5887
 
 
 
 
 
 
916a818
 
 
 
 
 
 
 
 
 
fea5887
 
 
 
 
 
 
 
 
 
 
 
916a818
fea5887
916a818
 
fea5887
 
 
 
 
 
 
 
916a818
 
fea5887
916a818
fea5887
916a818
 
 
 
 
 
 
fea5887
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
916a818
fea5887
916a818
fea5887
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
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
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
{
 "openapi": "3.0.3",
 "info": {
  "title": "Document OCR to Markdown (default): GLM-OCR (0.9B)",
  "version": "2026-11-21",
  "description": "Curated ZeroGPU tool from the ZeroGPU Inference Catalog. Calls go straight to the upstream Space prithivMLmods/GLM-OCR-Demo; send your own HF token as a bearer token so the call uses your ZeroGPU quota."
 },
 "servers": [
  {
   "url": "https://prithivmlmods-glm-ocr-demo.hf.space"
  }
 ],
 "x-zerogpu": {
  "category": "Documents and visual understanding",
  "slot": "Document OCR to Markdown",
  "need": "Faithful text, tables, formulas and layout from scans, photos and PDFs.",
  "role": "default",
  "space": "prithivMLmods/GLM-OCR-Demo",
  "space_url": "https://huggingface.co/spaces/prithivMLmods/GLM-OCR-Demo",
  "model": "GLM-OCR (0.9B)",
  "license": "MIT",
  "license_class": "open",
  "gpu_seconds_booked": "60",
  "notes": "Best and fastest in our matched test on real receipts and forms (word F1 0.95, 8 s; 2026-11-24). task: Text for plain text and tables.",
  "caveats": "",
  "lineup_call": "/run_router(task, image_b64)",
  "api_style": "v2"
 },
 "components": {
  "securitySchemes": {
   "hfToken": {
    "type": "http",
    "scheme": "bearer",
    "description": "Your own Hugging Face token (read scope is enough). It is sent only to the upstream Space and bills that call to your account's ZeroGPU quota. Without it the call runs on the small anonymous quota."
   }
  },
  "schemas": {}
 },
 "paths": {
  "/gradio_api/call/v2/run_router": {
   "post": {
    "summary": "Document OCR to Markdown (default): GLM-OCR (0.9B)",
    "description": "Faithful text, tables, formulas and layout from scans, photos and PDFs. Step 1 of 2: returns {\"event_id\"}; then GET /gradio_api/call/run_router/{event_id} reads an SSE stream whose `event: complete` data is the JSON output array (`event: error` on failure). Upstream: https://huggingface.co/spaces/prithivMLmods/GLM-OCR-Demo. License: MIT. Send these inputs (tested settings): {\"task\": \"Text\"}. Input image_b64 takes the file itself as a data URL (data:image/png;base64,...), not a path. \n\nUpstream description: Output must be fetched from GET /gradio_api/call/run_router/{event_id}. Returns an array of 1 elements of the following format: [\"output ({'type': 'string'})\"]",
    "operationId": "docs_vision_document_ocr_to_markdown",
    "requestBody": {
     "required": true,
     "content": {
      "application/json": {
       "schema": {
        "type": "object",
        "properties": {
         "task": {
          "type": "string"
         },
         "image_b64": {
          "type": "string"
         },
         "max_new_tokens_v": {
          "type": "number",
          "description": "numeric value between 1 and 8192"
         },
         "gpu_timeout_v": {
          "type": "number"
         }
        }
       }
      }
     }
    },
    "responses": {
     "200": {
      "description": "Job accepted.",
      "content": {
       "application/json": {
        "schema": {
         "type": "object",
         "required": [
          "event_id"
         ],
         "properties": {
          "event_id": {
           "type": "string"
          }
         }
        }
       }
      }
     }
    },
    "tags": [
     "Documents and visual understanding"
    ],
    "security": [
     {
      "hfToken": []
     },
     {}
    ]
   }
  },
  "/gradio_api/call/run_router/{event_id}": {
   "get": {
    "summary": "Fetch results for /run_router",
    "description": "Returns a stream of server-sent events (SSE). The final event has `event: complete` with `data` containing a JSON array of outputs.",
    "operationId": "docs_vision_document_ocr_to_markdown_result",
    "parameters": [
     {
      "name": "event_id",
      "in": "path",
      "required": true,
      "schema": {
       "type": "string"
      },
      "description": "The event_id returned by the POST request"
     }
    ],
    "responses": {
     "200": {
      "description": "SSE stream with event: complete containing a JSON array of outputs",
      "content": {
       "text/event-stream": {
        "schema": {
         "type": "string"
        }
       }
      }
     }
    },
    "tags": [
     "Documents and visual understanding"
    ],
    "security": [
     {
      "hfToken": []
     },
     {}
    ]
   }
  },
  "/gradio_api/upload": {
   "post": {
    "summary": "Upload File",
    "operationId": "docs_vision_document_ocr_to_markdown_upload",
    "parameters": [
     {
      "name": "upload_id",
      "in": "query",
      "required": false,
      "schema": {
       "type": "string",
       "nullable": true,
       "default": null
      },
      "description": "Optional ID to track upload progress"
     }
    ],
    "requestBody": {
     "required": true,
     "content": {
      "multipart/form-data": {
       "schema": {
        "type": "object",
        "properties": {
         "files": {
          "type": "array",
          "items": {
           "type": "string",
           "format": "binary"
          },
          "description": "One or more files to upload"
         }
        },
        "required": [
         "files"
        ]
       }
      }
     }
    },
    "responses": {
     "200": {
      "description": "List of file paths where the uploaded files were saved",
      "content": {
       "application/json": {
        "schema": {
         "type": "array",
         "items": {
          "type": "string"
         }
        }
       }
      }
     },
     "400": {
      "description": "Invalid content type or invalid file name",
      "content": {
       "text/plain": {
        "schema": {
         "type": "string"
        }
       }
      }
     },
     "413": {
      "description": "File exceeds maximum allowed size",
      "content": {
       "text/plain": {
        "schema": {
         "type": "string"
        }
       }
      }
     }
    },
    "security": [
     {
      "hfToken": []
     },
     {}
    ]
   }
  }
 }
}