For the complete documentation index, see llms.txt. This page is also available as Markdown.

GLM-OCR

Run GLM-OCR on an image to recognize text.

Recognize text in images using GLM-OCR, a vision language model by Zhipu AI specialized for optical character recognition.

GLM-OCR supports three built-in recognition modes:

  • Text Recognition - General-purpose text recognition for serial numbers, labels, scene text, and documents.

  • Formula Recognition - Recognizes mathematical formulas and equations.

  • Table Recognition - Recognizes table structures and content.

You can also select Custom Prompt to provide your own prompt for specialized recognition tasks, or Structured Output to extract values from the image into a JSON document with a user-defined schema (pair with the JSON Parser block to materialize the keys as workflow outputs).

This block pairs well with detection models and DynamicCropBlock to isolate regions of interest before running OCR. For example, use an object detection model to find labels or text regions, crop them, then pass the crops to GLM-OCR.

Note: GLM-OCR requires a GPU for inference.

Type identifier

Use the following identifier in step "type" field: roboflow_core/glm_ocr@v1 to add the block as a step in your workflow.

Properties

Name

Type

Description

Refs

name

str

Enter a unique identifier for this step..

task_type

str

Recognition task to perform. Determines the prompt sent to GLM-OCR. Accepts a selector (e.g. $inputs.task_type) so the mode can be set dynamically..

prompt

str

Custom text prompt for GLM-OCR. Only used when task_type is 'custom'..

output_structure

Dict[str, str]

Dictionary describing the structure of the expected JSON response. Keys are the JSON field names; values describe what the model should put in each field..

max_new_tokens

int

Maximum number of tokens to generate. If not set, the model default will be used..

model_version

str

The GLM-OCR model to be used for inference..

The Refs column marks possibility to parametrise the property with dynamic values available in workflow runtime. See Bindings for more info.

Runtime compatibility

hard - runtime self_hosted_cpu; execution local : Requires a GPU; run_locally() loads a model that needs CUDA.

Input and Output Bindings

The available connections depend on its binding kinds. Check what binding kinds GLM-OCR in version v1 has.

Input and output bindings
  • input

    • images (image): The image to infer on..

    • task_type (string): Recognition task to perform. Determines the prompt sent to GLM-OCR. Accepts a selector (e.g. $inputs.task_type) so the mode can be set dynamically..

    • prompt (string): Custom text prompt for GLM-OCR. Only used when task_type is 'custom'..

    • model_version (roboflow_model_id): The GLM-OCR model to be used for inference..

  • output

Example JSON definition

Last updated

Was this helpful?