notAI-tech / NudeNet

Lightweight nudity detection
https://nudenet.notai.tech/
GNU Affero General Public License v3.0
1.68k stars 334 forks source link

Nudity detection of an image URL not working in Default, I update the settings and it worked. Please edit the files and it will be alright. #92

Open SohaibShafiq1 opened 3 years ago

SohaibShafiq1 commented 3 years ago

First i use io as:

image_bytes = io.BytesIO(image-url) image = Image.open(image_bytes) result=classifier.classify(image)

then: in .virtaulenv>(venv-name)>lib>site-packages>nudenet>image_utils.py>load_img

Previous: if isinstance(path, type("")): img = pil_image.open(path) else: path = cv2.cvtColor(path, cv2.COLOR_BGR2RGB) img = pil_image.fromarray(path)

Now: if isinstance(path, type("")): img = pil_image.open(np.array(path)) else: path = cv2.cvtColor(np.array(path), cv2.COLOR_BGR2RGB) img = pil_image.fromarray(path)

It worked.

But if nudenet edit this from their end it will be good. Because when i will deploy the app, the actuall files be the files of nudenet not mine(image_utils.py file). So i wants to request the nudenet to update the code.

SohaibShafiq1 commented 3 years ago

In case if Someone deploys the app, he got the valid files on server running.

SohaibShafiq1 commented 3 years ago

I found the other solution as well. (image-url=The url of the image user wants to classify.) import numpy as np image_bytes = io.BytesIO(image-url) image = Image.open(image_bytes) result=classifier.classify(np.array(image)) It worked.