Update README.md
Browse files
README.md
CHANGED
@@ -51,6 +51,27 @@ More information needed
|
|
51 |
|
52 |
## Training procedure
|
53 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
54 |
### Training hyperparameters
|
55 |
|
56 |
The following hyperparameters were used during training:
|
|
|
51 |
|
52 |
## Training procedure
|
53 |
|
54 |
+
# use this model
|
55 |
+
```python
|
56 |
+
from transformers import pipeline
|
57 |
+
from PIL import Image
|
58 |
+
import requests
|
59 |
+
|
60 |
+
# Load the image classification pipeline with a specific model
|
61 |
+
pipe = pipeline("image-classification", "ozair23/swin-tiny-patch4-window7-224-finetuned-plantdisease")
|
62 |
+
|
63 |
+
# Load the image from a URL
|
64 |
+
url = 'https://huggingface.co/nielsr/convnext-tiny-finetuned-eurostat/resolve/main/forest.png'
|
65 |
+
image = Image.open(requests.get(url, stream=True).raw)
|
66 |
+
|
67 |
+
# Classify the image
|
68 |
+
results = pipe(image)
|
69 |
+
|
70 |
+
# Display the results
|
71 |
+
print("Predictions:")
|
72 |
+
for result in results:
|
73 |
+
print(f"Label: {result['label']}, Score: {result['score']:.4f}")
|
74 |
+
```
|
75 |
### Training hyperparameters
|
76 |
|
77 |
The following hyperparameters were used during training:
|