Document question answering (image + optional word_boxes)
curl --request POST \
--url https://api.synapsai.cloud/v1/question-answering/document \
--header 'Content-Type: application/json' \
--data '
{
"image": "<string>",
"question": "<string>",
"word_boxes": [
"<string>"
],
"top_k": 1,
"doc_stride": 128,
"max_answer_len": 15,
"max_seq_len": 384,
"max_question_len": 64,
"handle_impossible_answer": false,
"lang": "<string>",
"tesseract_config": "<string>",
"timeout": 123
}
'import requests
url = "https://api.synapsai.cloud/v1/question-answering/document"
payload = {
"image": "<string>",
"question": "<string>",
"word_boxes": ["<string>"],
"top_k": 1,
"doc_stride": 128,
"max_answer_len": 15,
"max_seq_len": 384,
"max_question_len": 64,
"handle_impossible_answer": False,
"lang": "<string>",
"tesseract_config": "<string>",
"timeout": 123
}
headers = {"Content-Type": "application/json"}
response = requests.post(url, json=payload, headers=headers)
print(response.text){
"score": 123,
"start": 123,
"end": 123,
"answer": "<string>",
"words": [
123
]
}Body
Request for document (image) question answering pipelines.
Image of the document (PIL-like object, base64 string or binary upload). Required.
Question to ask about the document. Required.
Optional list of (word, box) tuples or normalized bounding boxes to provide OCR words/boxes.
Number of top answers to return.
Stride size for splitting long documents into chunks with overlap.
Maximum length (in tokens) for returned answers.
Maximum total sequence length (context + question) in tokens.
Maximum question length after tokenization.
If true, allow returning an 'impossible' / no-answer result.
Language hint for OCR; default is English if omitted.
Extra configuration flags to pass to Tesseract OCR (if used).
Maximum time in seconds to wait for external image fetching/processing.
curl --request POST \
--url https://api.synapsai.cloud/v1/question-answering/document \
--header 'Content-Type: application/json' \
--data '
{
"image": "<string>",
"question": "<string>",
"word_boxes": [
"<string>"
],
"top_k": 1,
"doc_stride": 128,
"max_answer_len": 15,
"max_seq_len": 384,
"max_question_len": 64,
"handle_impossible_answer": false,
"lang": "<string>",
"tesseract_config": "<string>",
"timeout": 123
}
'import requests
url = "https://api.synapsai.cloud/v1/question-answering/document"
payload = {
"image": "<string>",
"question": "<string>",
"word_boxes": ["<string>"],
"top_k": 1,
"doc_stride": 128,
"max_answer_len": 15,
"max_seq_len": 384,
"max_question_len": 64,
"handle_impossible_answer": False,
"lang": "<string>",
"tesseract_config": "<string>",
"timeout": 123
}
headers = {"Content-Type": "application/json"}
response = requests.post(url, json=payload, headers=headers)
print(response.text){
"score": 123,
"start": 123,
"end": 123,
"answer": "<string>",
"words": [
123
]
}