Files
2026-05-23 17:22:03 -07:00

63 lines
2.0 KiB
Plaintext
Raw Permalink Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
----------------
nsfw-service
----------------
[ Usage ]
Send an HTTP POST request to port 9000 with the request body containing raw image data.
Supported formats: WEBP, PNG, GIF, JPEG.
Animated WEBPs and PNGs are not supported and will return a 415 status code.
For GIFs, only the first frame is used.
--- Response Status Codes ---
400 Invalid image data
405 Method not allowed (Use POST for inference and HEAD or GET for health)
411 Failed to read request body
413 Request body too large
415 Unsupported image type
422 Invalid image dimensions (>8192x4096px or <32px)
500 Server error, response body is plaintext
--- Example Response Body ---
{
"allowed": true,
"image": {
"hash_md5": "50f64bdb0f11d281505bce990e805569",
"hash_sha256": "f2a94429ccd5e5467f6a1f2bd166d8def75ced242a59b6f71b659e827c008b75",
"height": 850,
"width": 850
},
"logits": {
"drawing": 0.85562634,
"hentai": 0.14418653,
"neutral": 0.000010294689,
"porn": 0.00014420893,
"sexy": 0.00003254598
},
"timings": {
"classify": 7125,
"decode": 8746,
"probe": 0,
"total": 15871
}
}
[ Config ]
Configure the service using environment variables:
| Name | Default | Description
| HTTP_ADDRESS | 127.0.0.1:9000 | Address and Port to use for requests
| ONNX_RUNTIME_PATH | <empty> | Set to anything to enable CUDA, requires you supply your own ONNX runtime
| ONNX_RUNTIME_PATH | <empty> | Path to the ONNX runtime library, either a onnxruntime.dll or libonnxruntime.so
| HTTP_CONCURRENCY | 16 | Maximum concurrent api requests
| HTTP_MAX_BODY_BYTES | 16777216 | Maximum request size in bytes, default is 16MB
| MODEL_THRESHOLD | 0.7 | Threshold before an image is consider inappropriate
[ Credits ]
Uses the following AI model: https://github.com/GantMan/nsfw_model