How to use the nudenet.classifier.Classifier function in nudenet

To help you get started, we’ve selected a few nudenet examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github bedapudi6788 / NudeNet / nudenet / classifier.py View on Github external
images_preds = {}
        
        for i, loaded_image_path in enumerate(loaded_image_paths):
            images_preds[loaded_image_path] = {}
            for _ in range(len(preds[i])):
                images_preds[loaded_image_path][preds[i][_]] = probs[i][_]

        return images_preds


if __name__ == '__main__':
    print('\n Enter path for the keras weights, leave empty to use "./nsfw.299x299.h5" \n')
    weights_path = input().strip()
    if not weights_path: weights_path = "../nsfw.299x299.h5"
    
    m = Classifier(weights_path)

    while 1:
        print('\n Enter single image path or multiple images seperated by || (2 pipes) \n')
        images = input().split('||')
        images = [image.strip() for image in images]
        print(m.predict(images), '\n')