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

AttributeError: module 'stone' has no attribute 'process' #15

Closed ergo70 closed 9 months ago

ergo70 commented 9 months ago

The command line Version works, but:

I followed the instructions for using the library.

pip install skin-tone-classifier --upgrade

import stone

result = stone.process('xxx.jpg', image_type='color')

But then:

AttributeError: module 'stone' has no attribute 'process'

Python 3.10.11

ChenglongMa commented 9 months ago

Hi @ergo70,

Thanks for your feedback.

I tried on my side and in a Google Colab session, but it works well.

Can you give me more details to reproduce this problem? You can also check the Colab example here: Google Colab. It is a running example, so that you can see more intuitively how to use this library.

Thanks!

ergo70 commented 9 months ago

I tried with your minimal example:

pip uninstall skin-tone-classifier pip install skin-tone-classifier

skin-tone-classifier Version is 1.1.2

import stone

image_path = "https://raw.githubusercontent.com/ChenglongMa/SkinToneClassifier/main/docs/demo.png" # Use the demo.png stored in my repo

result = stone.process(image_path, image_type="color", return_report_image=False)

Traceback (most recent call last): File "c:\Devel\SkinToneAPI\stonetest.py", line 5, in result = stone.process(image_path, image_type="color", return_report_image=True) AttributeError: module 'stone' has no attribute 'process'

Maybe because I try it on Windows 11?

ergo70 commented 9 months ago

I now tried it on WSL2 Ubuntu 22.04.3 LTS / Python 3.10.12 and it works without problems.

As said, the stone.exe Script also works on Windows. The error occurs only when I try the library in code.

ChenglongMa commented 9 months ago

Hi @ergo70,

Are you using Anaconda, Miniconda, or pure Python? I have no Win 11 devices, but I will try creating another sandbox environment to reproduce the problem.

BTW, are there other folders or modules in your project named stone?

Thanks!

ergo70 commented 9 months ago

Obviously, I had a stone.py leftover from earlier tests. Now it works... ;-\

Sorry for tripping over this.

ChenglongMa commented 9 months ago

Hi @ergo70,

I'm glad your problem was solved.

Have a nice day :)