ChenglongMa / SkinToneClassifier

An easy-to-use library for skin tone classification
https://chenglongma.com/SkinToneClassifier/
GNU General Public License v3.0
97 stars 13 forks source link

Setting color palette throws TypeError: unhashable type: 'list' #25

Closed ergo70 closed 7 months ago

ergo70 commented 7 months ago

When trying to set a custom palette, e.g. in code:

stone.process(
        tmp_path, image_type='color', n_dominant_colors=5, tone_palette=["#6f503c", "#81654f", "#9d7a54", "#bea07e", "#e5c8a62"], tone_labels=[1, 2, 3, 4, 5])

I get TypeError: unhashable type: 'list' in File "/Python/Python310/lib/site-packages/stone/api.py", line 73, in process skin_tone_palette = normalize_palette(tone_palette)

I think this is the correct way, but I might be wrong, otherwise this is a bug.

best regards

Ernst-Georg

ChenglongMa commented 7 months ago

Thanks for your feedback. I will check and fix it soon :)

ergo70 commented 7 months ago

The same happens on the CLI:

stone -p "#6f503c #81654f #9d7a54 #bea07e #e5c8a6"

File "/Python/Python310/lib/site-packages/stone/main.py", line 123, in main specified_palette = normalize_palette(specified_palette) TypeError: unhashable type: 'list'

ChenglongMa commented 7 months ago

Hi @ergo70,

Thank you so much for your valuable feedback.

I've fixed it and released a new version.

Please upgrade the library by running one of the following commands:

pip install skin-tone-classifier[all] --upgrade

or

pip install skin-tone-classifier --upgrade

Thanks!

ergo70 commented 7 months ago

Yes, it works now as described.

Thank, you for fixing this.