Skip to content

Commit 9a1a4d1

Browse files
committed
fixed downloading
1 parent ca686a7 commit 9a1a4d1

File tree

2 files changed

+6
-5
lines changed

2 files changed

+6
-5
lines changed

ifnude/detector.py

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -2,8 +2,9 @@
22
import cv2
33
import numpy as np
44
import onnxruntime
5+
from pathlib import Path
56
from tqdm import tqdm
6-
import urllib
7+
import urllib.request
78

89
from .detector_utils import preprocess_image
910

@@ -21,8 +22,8 @@ def download(url, path):
2122
classes_url = "https://huggingface.co/s0md3v/nudity-checker/resolve/main/classes"
2223

2324

24-
home = os.path.expanduser("~")
25-
model_folder = os.path.join(home, f".models/")
25+
home = Path.home()
26+
model_folder = os.path.join(home, f".ifnude/")
2627
if not os.path.exists(model_folder):
2728
os.makedirs(model_folder)
2829

@@ -43,7 +44,7 @@ def download(url, path):
4344
def detect(img, mode="default", min_prob=None):
4445
# we are loading the model on every detect() because it crashes otherwise for some reason xD
4546
detection_model = onnxruntime.InferenceSession(model_path, providers=["CPUExecutionProvider"])
46-
47+
4748
if mode == "fast":
4849
image, scale = preprocess_image(img, min_side=480, max_side=800)
4950
if not min_prob:

setup.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@
1515
1616
AUTHOR = 'Somdev Sangwan'
1717
REQUIRES_PYTHON = '>=3.6.0'
18-
VERSION = '0.0.2'
18+
VERSION = '0.0.3'
1919

2020
# What packages are required for this module to be executed?
2121
REQUIRED = [

0 commit comments

Comments
 (0)