nielsr HF staff commited on
Commit
466da6d
1 Parent(s): 83d40fb

Update README.md

Browse files
Files changed (1) hide show
  1. README.md +4 -4
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-tiny-patch4-window7-224")
49
- model = SwinForImageClassification.from_pretrained("microsoft/swin-tiny-patch4-window7-224")
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, AutoModelForImageClassification
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-tiny-patch4-window7-224")
49
+ model = AutoModelForImageClassification.from_pretrained("microsoft/swin-tiny-patch4-window7-224")
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