docs: Minor fixes to demo code on README
#1
by
khanfarhan10
- opened
README.md
CHANGED
@@ -29,10 +29,10 @@ processor = AutoProcessor.from_pretrained("nielsr/layoutxlm-finetuned-xfund-fr")
|
|
29 |
model = AutoModelForTokenClassification.from_pretrained(nielsr/layoutxlm-finetuned-xfund-fr")
|
30 |
|
31 |
# assuming you have a French document, turned into an image
|
32 |
-
image = Image("...").convert("RGB")
|
33 |
|
34 |
# prepare for the model
|
35 |
-
encoding = processor(image,
|
36 |
|
37 |
with torch.no_grad():
|
38 |
outputs = model(**encoding)
|
|
|
29 |
model = AutoModelForTokenClassification.from_pretrained(nielsr/layoutxlm-finetuned-xfund-fr")
|
30 |
|
31 |
# assuming you have a French document, turned into an image
|
32 |
+
image = Image.open("...").convert("RGB")
|
33 |
|
34 |
# prepare for the model
|
35 |
+
encoding = processor(image, padding="max_length", max_length=512, truncation=True, return_tensors="pt")
|
36 |
|
37 |
with torch.no_grad():
|
38 |
outputs = model(**encoding)
|