Update README.md
Browse files
README.md
CHANGED
@@ -29,11 +29,13 @@ model = AutoModelForTokenClassification.from_pretrained(nielsr/layoutxlm-finetun
|
|
29 |
image = Image("...").convert("RGB")
|
30 |
|
31 |
# prepare for the model
|
32 |
-
encoding = processor(image, return_tensors="pt")
|
33 |
|
34 |
with torch.no_grad():
|
35 |
outputs = model(**encoding)
|
36 |
logits = outputs.logits
|
|
|
|
|
37 |
```
|
38 |
|
39 |
## Intended uses & limitations
|
|
|
29 |
image = Image("...").convert("RGB")
|
30 |
|
31 |
# prepare for the model
|
32 |
+
encoding = processor(image, return_offsets_mapping=True, padding="max_length", max_length=512, truncation=True, return_tensors="pt")
|
33 |
|
34 |
with torch.no_grad():
|
35 |
outputs = model(**encoding)
|
36 |
logits = outputs.logits
|
37 |
+
|
38 |
+
predictions = logits.argmax(-1)
|
39 |
```
|
40 |
|
41 |
## Intended uses & limitations
|