Update code example
Browse files
README.md
CHANGED
@@ -31,13 +31,13 @@ Here is how to use this model for semantic segmentation:
|
|
31 |
|
32 |
```python
|
33 |
from transformers import BeitFeatureExtractor, BeitForSemanticSegmentation
|
|
|
34 |
from PIL import Image
|
35 |
-
import requests
|
36 |
|
37 |
-
|
38 |
-
|
39 |
|
40 |
-
feature_extractor = BeitFeatureExtractor(
|
41 |
model = BeitForImageClassification.from_pretrained('microsoft/beit-large-finetuned-ade-640-640')
|
42 |
|
43 |
inputs = feature_extractor(images=image, return_tensors="pt")
|
|
|
31 |
|
32 |
```python
|
33 |
from transformers import BeitFeatureExtractor, BeitForSemanticSegmentation
|
34 |
+
from datasets import load_dataset
|
35 |
from PIL import Image
|
|
|
36 |
|
37 |
+
# load ADE20k image
|
38 |
+
ds = load_dataset("hf-internal-testing/fixtures_ade20k", split="test")
|
39 |
|
40 |
+
feature_extractor = BeitFeatureExtractor.from_pretrained('microsoft/beit-large-finetuned-ade-640-640')
|
41 |
model = BeitForImageClassification.from_pretrained('microsoft/beit-large-finetuned-ade-640-640')
|
42 |
|
43 |
inputs = feature_extractor(images=image, return_tensors="pt")
|