Fix var name

This commit is contained in:
Antonio J. Delgado 2021-09-06 16:05:04 +03:00
parent 6633262d59
commit 8cb899b9de

View file

@ -43,14 +43,14 @@ class CustomFormatter(logging.Formatter):
class image_classifier: class image_classifier:
def __init__(self, debug_level, log_file, faces_folder, directory): def __init__(self, debug_level, log_file, faces_directory, directory):
''' Initial function called when object is created ''' ''' Initial function called when object is created '''
self.debug_level = debug_level self.debug_level = debug_level
if log_file is None: if log_file is None:
log_file = os.path.join(os.environ.get('HOME', os.environ.get('USERPROFILE', os.getcwd())), 'log', 'image_classifier.log') log_file = os.path.join(os.environ.get('HOME', os.environ.get('USERPROFILE', os.getcwd())), 'log', 'image_classifier.log')
self.log_file = log_file self.log_file = log_file
self._init_log() self._init_log()
self.faces_folder = faces_folder self.faces_directory = faces_directory
self.directory = directory self.directory = directory
self.known_people = self.load_known_people() self.known_people = self.load_known_people()
@ -74,8 +74,8 @@ class image_classifier:
def load_known_people(self): def load_known_people(self):
known_people = list() known_people = list()
if os.access(self.faces_folder, os.R_OK): if os.access(self.faces_directory, os.R_OK):
with os.scandir(self.faces_folder) as faces_items: with os.scandir(self.faces_directory) as faces_items:
for entry in faces_items: for entry in faces_items:
if not entry.name.startswith('.') and entry.is_file(): if not entry.name.startswith('.') and entry.is_file():
person = dict() person = dict()
@ -132,8 +132,8 @@ class image_classifier:
@click.option("--faces-directory","-f", required=True, help="Folder containing the pictures that identify people. The filename would be used as the name for the person. Just one person per picture.") @click.option("--faces-directory","-f", required=True, help="Folder containing the pictures that identify people. The filename would be used as the name for the person. Just one person per picture.")
@click.option("--directory","-d", required=True, help="Folder containing the pictures to classify.") @click.option("--directory","-d", required=True, help="Folder containing the pictures to classify.")
@click_config_file.configuration_option() @click_config_file.configuration_option()
def __main__(debug_level, log_file, faces_folder, directory): def __main__(debug_level, log_file, faces_directory, directory):
object = image_classifier(debug_level, log_file, faces_folder, directory) object = image_classifier(debug_level, log_file, faces_directory, directory)
if __name__ == "__main__": if __name__ == "__main__":
__main__() __main__()