Skip to content

Commit

Permalink
Merge pull request #188 from C-BP/main
Browse files Browse the repository at this point in the history
docs:add Tagger API example
  • Loading branch information
mix1009 authored Dec 14, 2024
2 parents 6747783 + 6ac2a3c commit ee9b91a
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 2 deletions.
10 changes: 10 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -506,6 +506,16 @@ semantic_seg_result = segment.sam_and_semantic_seg_with_cat_id(
)
```

### Extension support - Tagger (contributed by C-BP)

```python
# https://github.com/Akegarasu/sd-webui-wd14-tagger

tagger = webuiapi.TaggerInterface(api)
result = tagger.tagger_interrogate(image)
print(result)
# {"caption": {"additionalProp1":0.9,"additionalProp2": 0.8,"additionalProp3": 0.7}}
```
### Extension support - ADetailer (contributed by tomj2ee and davidmartinrius)
#### txt2img with ADetailer
```
Expand Down
4 changes: 2 additions & 2 deletions webuiapi/webuiapi.py
Original file line number Diff line number Diff line change
Expand Up @@ -2009,14 +2009,14 @@ class TaggerInterface:
def __init__(self, webuiapi: WebUIApi):
self.api = webuiapi

def tagger_interrogate(self, image, model="wd14-vit-v2-git", threshold=0.0, use_async=False):
def tagger_interrogate(self, image, model="wd14-vit-v2-git", threshold=0.3, use_async=False):
"""
Interrogates the tagger model with the provided image and parameters.
Args:
image (Image.Image or str): The image to be interrogated. Can be a PIL Image object or a base64 encoded string.
model (str, optional): The model to use for interrogation. Defaults to "wd14-vit-v2-git".
threshold (float, optional): The threshold value for the model. Defaults to 0.
threshold (float, optional): The threshold value for the model. Defaults to 0.3
use_async (bool, optional): Whether to use asynchronous processing. Defaults to False.
Returns:
Expand Down

0 comments on commit ee9b91a

Please sign in to comment.