Pix2struct Docvqa Base

PIX2STRUCT_DOCVQA_BASE

Pix2Struct from Google answers a question about a document image such as a scan, form, receipt or slide.

Vision & Analysisdocument-qaocr-freedocumentapache-2.0
Pix2struct Docvqa Base: Vision & Analysis model on Kainguru

About Pix2struct Docvqa Base

Answers a question about a document image: a scan, a form, a receipt, or a slide. You send the image and the question. The reply is a short text answer read from the page.

The weights are google/pix2struct-docvqa-base at revision 63f6b3de436e39f75c7a486881a9c2c14a7f4e89, published by Google and added to the Hub by Younes Belkada. Pix2Struct was created by Kenton Lee, Mandar Joshi, Iulia Turc, Hexiang Hu, Fangyu Liu, Julian Eisenschlos, Urvashi Khandelwal, Peter Shaw, Ming-Wei Chang and Kristina Toutanova. The model card states the licence as Apache-2.0: https://huggingface.co/google/pix2struct-docvqa-base. The weights file model.safetensors is 1,129,177,976 bytes (about 1.05 GB) and is public.

Limits

Still images only. One image and one question per request. A file over 20 MB, or over 4096 pixels on either side, is refused. A question longer than 300 characters is refused. The model reads the page as a picture, so handwriting, tiny type, stamps and glare can be missed or misread. The answer is a short generation, not a verified extraction, and it can be wrong. The model runs on CPU in fp32. About 282 million parameters.

Pix2struct Docvqa Base inputs and output

NameTypeRequiredDefaultDetails
imagefileYes—Document image (scan, form, receipt or slide). PNG, JPEG or WebP, at most 20 MB and 4096 pixels on a side.
image/jpeg, png, webp
questiontextYes—Question about the document, at most 300 characters.
Max 300 characters
max_new_tokensintegerNo64Maximum number of new tokens in the answer, from 8 to 256.
8–256

Output. Returns plain text.

Run Pix2struct Docvqa Base with the API

Send your API key in the X-API-Key header. The run is asynchronous: submit it, then poll it until it finishes. Create an API key.

cURL
curl -X POST "https://api.kainguru.com/api/v1/executions?mlFlowId=PIX2STRUCT_DOCVQA_BASE" \
  -H "X-API-Key: kg_your_api_key" \
  -H "Content-Type: application/json" \
  -d '{
  "input": {
    "image": "https://example.com/input.png",
    "question": "example",
    "max_new_tokens": 64
  },
  "outputFormat": "json"
}'

# Poll until the execution reaches a terminal state
curl "https://api.kainguru.com/api/v1/executions/{executionId}" \
  -H "X-API-Key: kg_your_api_key"
Python
from kainguru import KainguruClient

with KainguruClient(api_key="kg_your_api_key", base_url="https://api.kainguru.com/api") as client:
    submitted = client.executions.execute(
        "PIX2STRUCT_DOCVQA_BASE",
        {
          "image": "https://example.com/input.png",
          "question": "example",
          "max_new_tokens": 64
        },
        output_format="json",
    )
    result = client.executions.await_completion(submitted.id)
    print(result.execution.output)

Pix2struct Docvqa Base pricing

Price per request: 0.18 credits ($0.0018). The price is shown again before every run; all prices are on the pricing page.

Licence and source

Deplot: Vision & Analysis model on Kainguru
Vision & Analysis

Deplot

DePlot from Google reads a chart or plot image and returns the data table drawn in it.

Docling Layout Heron: Vision & Analysis model on Kainguru
Vision & Analysis

Docling Layout Heron

Finds the layout of a document page, such as text blocks, titles, section headers, tables, pictures, captions…

Fine-tunable
EasyOCR: Vision & Analysis model on Kainguru
Vision & Analysis

EasyOCR

EasyOCR finds the lines of text in a photo or a scan and reads each one, returning every line with its box and its…

Fine-tunable
Granite Vision 3.3 2B: Vision & Analysis model on Kainguru
Vision & Analysis

Granite Vision 3.3 2B

IBM Granite Vision 3.3 2B reads documents in pictures: it answers questions about tables, charts, infographics, forms…

Fine-tunable
Grounding DINO Base: Vision & Analysis model on Kainguru
Vision & Analysis

Grounding DINO Base

Finds the things you name in a picture, such as "red car, person with a helmet", and returns a box around each one.

Fine-tunable
Moondream 2: Vision & Analysis model on Kainguru
Vision & Analysis

Moondream 2

Moondream 2 is a small vision model: it answers questions about a picture, writes short, normal or long captions and…

Fine-tunable