English | 简体中文
A API to check porn image, base on NSFWJS. This is a Gfriends derivative project.
Common formats supported, such as jpg
,png
,jpeg
.
Default API URL: https://{APP-Name}.herokuapp.com/api
, change API_PATH
if you want to anti-hotlinking.
Recommended environment is NodeJS 16 or higher.
git clone https://github.com/gfriends/pornchecker
cd pornchecker
npm i
npm i -g pm2
pm2 start index.js --name pornchecker
Default API URL: http(s)://{IP}:5000/api
Request:HTTP POST, post binary image file with Content-Type header.
# Example with Curl
curl "http(s)://{API_URL}/api" -F "image=@/{PATH}/{FILENAME}.jpg;type=image/jpg"
# Example with Python3
import requests
data = {'image': ('{FILENAME}.jpg', open("/{PATH}/{FILENAME}.jpg", 'rb'), "image/jpg")}
response = requests.post('http(s)://{API_URL}/api', files = data)
print(response.text)
Response:
[
{
"className": "Neutral",
"probability": 0.9277840852737427
},
{
"className": "Drawing",
"probability": 0.07143104821443558
},
{
"className": "Hentai",
"probability": 0.0007780276937410235
},
{
"className": "Porn",
"probability": 0.000005075656645203708
},
{
"className": "Sexy",
"probability": 0.0000018030658566203783
}
]
className
meaning:
Drawing
- safe for work drawings (including anime)Hentai
- hentai and pornographic drawingsNeutral
- safe for work neutral imagesPorn
- pornographic images, sexual actsSexy
- sexually explicit images, not pornography
probability
meaning:
Range 0-1 , the higher value means closer to that type. In most cases, the highest value is used to determine the image type.