Update README.md
Browse files
README.md
CHANGED
@@ -39,17 +39,17 @@ fine-tuned versions on a task that interests you.
|
|
39 |
Here is how to use this model:
|
40 |
|
41 |
```python
|
42 |
-
>>> from transformers import
|
43 |
>>> import torch
|
44 |
>>> from datasets import load_dataset
|
45 |
|
46 |
>>> dataset = load_dataset("huggingface/cats-image")
|
47 |
>>> image = dataset["test"]["image"][0]
|
48 |
|
49 |
-
>>>
|
50 |
-
>>> model =
|
51 |
|
52 |
-
>>> inputs =
|
53 |
|
54 |
>>> with torch.no_grad():
|
55 |
... logits = model(**inputs).logits
|
|
|
39 |
Here is how to use this model:
|
40 |
|
41 |
```python
|
42 |
+
>>> from transformers import AutoImageProcessor, AutoModelForImageClassification
|
43 |
>>> import torch
|
44 |
>>> from datasets import load_dataset
|
45 |
|
46 |
>>> dataset = load_dataset("huggingface/cats-image")
|
47 |
>>> image = dataset["test"]["image"][0]
|
48 |
|
49 |
+
>>> image_processor = AutoImageProcessor.from_pretrained("microsoft/resnet-18")
|
50 |
+
>>> model = AutoModelForImageClassification.from_pretrained("microsoft/resnet-18")
|
51 |
|
52 |
+
>>> inputs = image_processor(image, return_tensors="pt")
|
53 |
|
54 |
>>> with torch.no_grad():
|
55 |
... logits = model(**inputs).logits
|