Commit
·
3e373be
1
Parent(s):
0c1a4b9
docs: Minor fixes to demo code on README (#1)
Browse files- docs: Minor fixes to demo code on README (743bd798ffd783ab542dc0019f2595c27d47f584)
Co-authored-by: Farhan Hai Khan <[email protected]>
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)
|