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