Update README.md
Browse files
README.md
CHANGED
@@ -29,16 +29,16 @@ You can use the raw model for encoding document images into a vector space, but
|
|
29 |
Here is how to use this model in PyTorch:
|
30 |
|
31 |
```python
|
32 |
-
from transformers import
|
33 |
import torch
|
34 |
from PIL import Image
|
35 |
|
36 |
image = Image.open('path_to_your_document_image').convert('RGB')
|
37 |
|
38 |
-
|
39 |
model = AutoModelForImageClassification.from_pretrained("microsoft/dit-large-finetuned-rvlcdip")
|
40 |
|
41 |
-
inputs =
|
42 |
outputs = model(**inputs)
|
43 |
logits = outputs.logits
|
44 |
|
|
|
29 |
Here is how to use this model in PyTorch:
|
30 |
|
31 |
```python
|
32 |
+
from transformers import AutoImageProcessor, AutoModelForImageClassification
|
33 |
import torch
|
34 |
from PIL import Image
|
35 |
|
36 |
image = Image.open('path_to_your_document_image').convert('RGB')
|
37 |
|
38 |
+
processor = AutoImageProcessor.from_pretrained("microsoft/dit-large-finetuned-rvlcdip")
|
39 |
model = AutoModelForImageClassification.from_pretrained("microsoft/dit-large-finetuned-rvlcdip")
|
40 |
|
41 |
+
inputs = processor(images=image, return_tensors="pt")
|
42 |
outputs = model(**inputs)
|
43 |
logits = outputs.logits
|
44 |
|