MediPlusPlus commited on
Commit
0282277
1 Parent(s): d9846be
Files changed (1) hide show
  1. layoutlm.py +12 -0
layoutlm.py ADDED
@@ -0,0 +1,12 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ from transformers import pipeline
2
+
3
+
4
+ def get_result(image_path, question):
5
+ nlp = pipeline(
6
+ "document-question-answering",
7
+ model="impira/layoutlm-document-qa",
8
+ )
9
+
10
+ result = nlp(image_path, question)
11
+
12
+ return result[0]['answer']