notAI-tech / NudeNet

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

Getting type error takes 1 positional argument but 2 were given while using classifier.classify('img_path') #101

Open amshrbo opened 3 years ago

amshrbo commented 3 years ago

TypeError: array() takes 1 positional argument but 2 were given when trying to use the classify method I get this error

**The code snippet which gave this error***

clf.classify('/home/shrbo/Downloads/dtest.jpeg')

libraries versions

  1. nudenet==2.0.9
  2. numpy==1.21.0

Expected behavior The nsfw score

Output ERROR:root:Error reading /home/shrbo/Downloads/dtest.jpeg array() takes 1 positional argument but 2 were given Traceback (most recent call last): File "/home/shrbo/venvpy/nudetest/lib/python3.7/site-packages/nudenet/image_utils.py", line 134, in load_images image = img_to_array(image) File "/home/shrbo/venvpy/nudetest/lib/python3.7/site-packages/nudenet/image_utils.py", line 102, in img_to_array x = np.asarray(img, dtype=dtype) TypeError: array() takes 1 positional argument but 2 were given Out[3]: {}

This Solution only worked on older version that I've installed, doesn't work on newly created ones uninstalling nudenet==2.0.9 Installing nudenet==2.0.8 The numpy version after installing 2.0.8 is numpy==1.20.3 The problem solved

amshrbo commented 3 years ago

The Solution