-
Notifications
You must be signed in to change notification settings - Fork 3
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #2 from amshrbo/api
Fully working api that can handle multiple images from one request.
- Loading branch information
Showing
3 changed files
with
79 additions
and
18 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1 +1,2 @@ | ||
*__pycache__* | ||
uploadedImgs/* |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
def nsfw_check(results): | ||
content = { | ||
'nude': False, | ||
'violence': False | ||
# 'drugs': False | ||
} | ||
|
||
for res in results: | ||
if res['preds']['nude_score'] >= 80: | ||
content['nude'] = True | ||
|
||
# if res['preds']['drugs_score'] > 35 and res['preds']['natural_score'] < 25: | ||
# content['drugs'] = True | ||
|
||
if res['preds']['violence_score'] > 35 and res['preds']['natural_score'] < 25: | ||
content['violence'] = True | ||
|
||
if res['preds']['violence_score'] > 39: | ||
content['violence'] = True | ||
|
||
return content |