nielsr HF staff commited on
Commit
68dc766
1 Parent(s): 5c4c8f1

Update README.md

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