Skip to content

Commit

Permalink
suppress logging from nudenet
Browse files Browse the repository at this point in the history
  • Loading branch information
yaroslaff committed Apr 12, 2023
1 parent 9b0deed commit 1264654
Show file tree
Hide file tree
Showing 4 changed files with 12 additions and 13 deletions.
6 changes: 5 additions & 1 deletion bin/nudecrawler
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ import os
import shlex
import shutil
import subprocess
import logging
import requests
from dotenv import load_dotenv

Expand Down Expand Up @@ -337,7 +338,10 @@ def main():
sanity_check(args)

# when fastforward, we go to specific word/day/count quickly
fastforward = False
fastforward = False

# Disabled logger for nudenet
logging.getLogger().disabled = True

if args.unbuffered:
sys.stdout = Unbuffered(sys.stdout)
Expand Down
8 changes: 4 additions & 4 deletions build-docker.sh
Original file line number Diff line number Diff line change
Expand Up @@ -17,11 +17,11 @@ then
elif [ "$MODE" == "publish" ]
then
echo publish version $VERSION
python3 setup.py bdist_wheel sdist
twine upload dist/nudecrawler*$VERSION*
# python3 setup.py bdist_wheel sdist
# twine upload dist/nudecrawler*$VERSION*

echo build version $MODE
echo === $MODE
echo build version $VERSION
echo === $VERSION
sudo docker build --build-arg VERSION=$VERSION -t yaroslaff/nudecrawler:$VERSION -f docker/Dockerfile .

echo === LATEST
Expand Down
9 changes: 2 additions & 7 deletions nudecrawler/remoteimage.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
import subprocess
import nude
from .exceptions import ProblemImage

from .verbose import printv

# detector_address = 'http://localhost:9191/api/v1/detect'

Expand Down Expand Up @@ -98,14 +98,9 @@ def nudenet_detect(self):
except Exception as e:
print(f"Got uncaught exception {type(e)}: {e}")


# sometimes no exception, but empty response, e.g. when mp4 instead of image
if not r:
print(f"Err: {self.url} empty reply")
result = {
'status': 'ERROR',
'error': "empty reply from classifier"
}
printv(f"Err: {self.url} empty reply")
return False

if r[self.path]['unsafe'] > self.threshold:
Expand Down
2 changes: 1 addition & 1 deletion nudecrawler/version.py
Original file line number Diff line number Diff line change
@@ -1 +1 @@
version="0.3.13"
version="0.3.14"

0 comments on commit 1264654

Please sign in to comment.