Update README.md
Browse files
README.md
CHANGED
@@ -102,22 +102,4 @@ The model performs well on document-style QA tasks, especially with:
|
|
102 |
|
103 |
## How to Use
|
104 |
|
105 |
-
|
106 |
-
from transformers import LayoutLMv3Processor, LayoutLMv3ForQuestionAnswering
|
107 |
-
from PIL import Image
|
108 |
-
import torch
|
109 |
-
|
110 |
-
processor = LayoutLMv3Processor.from_pretrained("lakshya-singh/document-qa-model")
|
111 |
-
model = LayoutLMv3ForQuestionAnswering.from_pretrained("lakshya-singh/document-qa-model")
|
112 |
-
|
113 |
-
image = Image.open("your_document.png")
|
114 |
-
question = "What is the total amount due?"
|
115 |
-
|
116 |
-
inputs = processor(image, question, return_tensors="pt")
|
117 |
-
outputs = model(**inputs)
|
118 |
-
|
119 |
-
start_idx = torch.argmax(outputs.start_logits)
|
120 |
-
end_idx = torch.argmax(outputs.end_logits)
|
121 |
-
|
122 |
-
answer = processor.tokenizer.decode(inputs["input_ids"][0][start_idx:end_idx+1])
|
123 |
-
print("Answer:", answer)
|
|
|
102 |
|
103 |
## How to Use
|
104 |
|
105 |
+
- Available on my Github
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|