nielsr HF staff commited on
Commit
2ddc9d4
1 Parent(s): 5dca96d

Update README.md

Browse files
Files changed (1) hide show
  1. README.md +3 -3
README.md CHANGED
@@ -39,17 +39,17 @@ fine-tuned versions on a task that interests you.
39
  Here is how to use this model to classify an image of the COCO 2017 dataset into one of the 1,000 ImageNet classes:
40
 
41
  ```python
42
- from transformers import ViTFeatureExtractor, ViTForImageClassification
43
  from PIL import Image
44
  import requests
45
 
46
  url = 'http://images.cocodataset.org/val2017/000000039769.jpg'
47
  image = Image.open(requests.get(url, stream=True).raw)
48
 
49
- feature_extractor = ViTFeatureExtractor.from_pretrained('google/vit-base-patch16-224')
50
  model = ViTForImageClassification.from_pretrained('google/vit-base-patch16-224')
51
 
52
- inputs = feature_extractor(images=image, return_tensors="pt")
53
  outputs = model(**inputs)
54
  logits = outputs.logits
55
  # model predicts one of the 1000 ImageNet classes
 
39
  Here is how to use this model to classify an image of the COCO 2017 dataset into one of the 1,000 ImageNet classes:
40
 
41
  ```python
42
+ from transformers import ViTImageProcessor, ViTForImageClassification
43
  from PIL import Image
44
  import requests
45
 
46
  url = 'http://images.cocodataset.org/val2017/000000039769.jpg'
47
  image = Image.open(requests.get(url, stream=True).raw)
48
 
49
+ processor = ViTImageProcessor.from_pretrained('google/vit-base-patch16-224')
50
  model = ViTForImageClassification.from_pretrained('google/vit-base-patch16-224')
51
 
52
+ inputs = processor(images=image, return_tensors="pt")
53
  outputs = model(**inputs)
54
  logits = outputs.logits
55
  # model predicts one of the 1000 ImageNet classes