jzhang533 commited on
Commit
e548940
·
verified ·
1 Parent(s): b3428f1

Update README.md

Browse files
Files changed (1) hide show
  1. README.md +5 -2
README.md CHANGED
@@ -34,12 +34,15 @@ Since this model is a more efficiently trained ViT model, you can plug it into V
34
  Here is how to use this model to classify an image of the COCO 2017 dataset into one of the 1,000 ImageNet classes:
35
 
36
  ```python
37
- from transformers import AutoFeatureExtractor, ViTForImageClassification
38
  from PIL import Image
39
  import requests
40
  url = 'http://images.cocodataset.org/val2017/000000039769.jpg'
41
  image = Image.open(requests.get(url, stream=True).raw)
42
- feature_extractor = AutoFeatureExtractor.from_pretrained('facebook/deit-tiny-patch16-224')
 
 
 
43
  model = ViTForImageClassification.from_pretrained('facebook/deit-tiny-patch16-224')
44
  inputs = feature_extractor(images=image, return_tensors="pt")
45
  outputs = model(**inputs)
 
34
  Here is how to use this model to classify an image of the COCO 2017 dataset into one of the 1,000 ImageNet classes:
35
 
36
  ```python
37
+ from transformers import AutoImageProcessor, ViTForImageClassification
38
  from PIL import Image
39
  import requests
40
  url = 'http://images.cocodataset.org/val2017/000000039769.jpg'
41
  image = Image.open(requests.get(url, stream=True).raw)
42
+ processor = AutoImageProcessor.from_pretrained("facebook/deit-tiny-patch16-224")
43
+ model = AutoModelForImageClassification.from_pretrained("facebook/deit-tiny-patch16-224")
44
+
45
+
46
  model = ViTForImageClassification.from_pretrained('facebook/deit-tiny-patch16-224')
47
  inputs = feature_extractor(images=image, return_tensors="pt")
48
  outputs = model(**inputs)