File size: 256 Bytes
0bd5bed
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
from transformers import pipeline


def get_result(image_path, question):
    nlp = pipeline(
        "document-question-answering",
        model="impira/layoutlm-document-qa",
    )

    result = nlp(image_path, question)

    return result[0]['answer']