🎉 init(wdtagger): a simple and easy-to-use wrapper for wdtagger
This commit is contained in:
BIN
tests/images/赤松楓.9d64b955.jpeg
Normal file
BIN
tests/images/赤松楓.9d64b955.jpeg
Normal file
Binary file not shown.
After Width: | Height: | Size: 92 KiB |
22
tests/test_tagger.py
Normal file
22
tests/test_tagger.py
Normal file
@ -0,0 +1,22 @@
|
||||
import pytest
|
||||
from PIL import Image
|
||||
|
||||
from wdtagger import Tagger
|
||||
|
||||
|
||||
@pytest.fixture
|
||||
def tagger():
|
||||
return Tagger()
|
||||
|
||||
|
||||
@pytest.fixture
|
||||
def image_file():
|
||||
return "./tests/images/赤松楓.9d64b955.jpeg"
|
||||
|
||||
|
||||
def test_tagger(tagger, image_file):
|
||||
image = Image.open(image_file)
|
||||
result = tagger.tag(image, character_threshold=0.85, general_threshold=0.35)
|
||||
|
||||
assert result.character_tags_string == "akamatsu kaede"
|
||||
assert result.rating == "general"
|
Reference in New Issue
Block a user