NSFW?
nsfw is a library for determining the not-safe-for-work-ness of images.
It is based off of GantMan's model.
Prerequisites
Because Cargo has a size limit of 10mb, the pre-trained model cannot be included in the crate. You will need to download it from the release page or download the model yourself and convert it into ONNX
Downloading from the release page (easy)
# or naviate to the release page and download it manually
Convering from GantMan's model
See our GitHub Workflow
Example: Static Images
[]
= { = "0.24.7", = false, = ["jpeg"] }
= { = "0.1.0", = false, = ["jpeg"] }
use ;
Example: GIF
[]
= { = "0.24.7", = false, = ["gif"] }
= { = "0.1.0", = false, = ["gif"] }
use ;
Feature Flags
default-jpegandpngserde- Enables serialization and deserialization of the model usingserde.gif- Enables GIF support forimage.jpeg- Enables JPEG support forimage.png- Enables PNG support forimage.webp- Enables WEBP support forimage.
Benchmarking
| Name | Size | Language | Time |
|---|---|---|---|
| test_porn.gif | 50495726 bytes (50.49 MB) |
Rust | 22.719 seconds |
| test_porn.gif | 50495726 bytes (50.49 MB) |
JavaScript | 219.96 seconds |