nielsr HF staff commited on
Commit
2612d78
1 Parent(s): 767d25e

Update README.md

Browse files
Files changed (1) hide show
  1. README.md +6 -3
README.md CHANGED
@@ -32,14 +32,17 @@ You can use the raw model to embed images, but it's mostly intended to be fine-t
32
  Here is how to use this model:
33
 
34
  ```python
35
- from transformers import ViTFeatureExtractor, ViTModel
36
  from PIL import Image
37
  import requests
 
38
  url = 'http://images.cocodataset.org/val2017/000000039769.jpg'
39
  image = Image.open(requests.get(url, stream=True).raw)
40
- feature_extractor = ViTFeatureExtractor.from_pretrained('google/vit-large-patch16-224-in21k')
 
41
  model = ViTModel.from_pretrained('google/vit-large-patch16-224-in21k')
42
- inputs = feature_extractor(images=image, return_tensors="pt")
 
43
  outputs = model(**inputs)
44
  last_hidden_state = outputs.last_hidden_state
45
  ```
 
32
  Here is how to use this model:
33
 
34
  ```python
35
+ from transformers import ViTImageProcessor, ViTModel
36
  from PIL import Image
37
  import requests
38
+
39
  url = 'http://images.cocodataset.org/val2017/000000039769.jpg'
40
  image = Image.open(requests.get(url, stream=True).raw)
41
+
42
+ processor = ViTImageProcessor.from_pretrained('google/vit-large-patch16-224-in21k')
43
  model = ViTModel.from_pretrained('google/vit-large-patch16-224-in21k')
44
+
45
+ inputs = processor(images=image, return_tensors="pt")
46
  outputs = model(**inputs)
47
  last_hidden_state = outputs.last_hidden_state
48
  ```