Update README.md
Browse files
README.md
CHANGED
@@ -25,17 +25,25 @@ It achieves the following results on the evaluation set:
|
|
25 |
This model is an experimental model that predicts danbooru tags of images.
|
26 |
|
27 |
## Example
|
|
|
|
|
|
|
28 |
```py
|
29 |
from transformers import pipeline
|
30 |
-
|
31 |
-
pipe("image
|
32 |
-
|
33 |
-
|
34 |
-
|
|
|
|
|
35 |
```
|
|
|
36 |
* `threshold`: confidence intervale, if it's specified, the pipeline will only return tags with a confidence >= threshold
|
37 |
* `return_scores`: if specified the pipeline will return the labels and their confidences in a dictionary format.
|
38 |
|
|
|
|
|
39 |
```py
|
40 |
from PIL import Image
|
41 |
import torch
|
|
|
25 |
This model is an experimental model that predicts danbooru tags of images.
|
26 |
|
27 |
## Example
|
28 |
+
|
29 |
+
### Use a pipeline
|
30 |
+
|
31 |
```py
|
32 |
from transformers import pipeline
|
33 |
+
|
34 |
+
pipe = pipeline("image-classification", model="p1atdev/siglip-tagger-test-3", trust_remote_code=True)
|
35 |
+
pipe(
|
36 |
+
"image.jpg", # takes str(path) or numpy array or PIL images as input
|
37 |
+
threshold=0.5, #optional parameter defaults to 0
|
38 |
+
return_scores = False #optional parameter defaults to False
|
39 |
+
)
|
40 |
```
|
41 |
+
|
42 |
* `threshold`: confidence intervale, if it's specified, the pipeline will only return tags with a confidence >= threshold
|
43 |
* `return_scores`: if specified the pipeline will return the labels and their confidences in a dictionary format.
|
44 |
|
45 |
+
### Load model directly
|
46 |
+
|
47 |
```py
|
48 |
from PIL import Image
|
49 |
import torch
|