This module contains generally useful, atomic commands that aren’t otherwise categorized into a dedicated module.
These commands might be safe for use by anyone, or locked behind in-Discord permissions.
NSFW Images Detection Tools¶
GiselleBot implements an (experimental) NSFW images detection system using TensorFlow.js as its base.
The detection system is based on Infinite Red’s NSFW JS library and GantMan’s Inception v3 Keras Model for NSFW detection to classify any image as a composition of 5 categories:
Drawings: Safe for work drawings (including anime).
Hentai: Hentai and pornographic drawings.
Neutral: Safe for work neutral images.
Porn: Pornographic images, sexual acts.
Sexy: Sexually explicit images, not pornography.
The module was furtherly converted into a back-end module and customized with a caching system to enhance its performance.
This interesting article by Infinite Red explains the reasons behind the creation of the original NSFW JS client-side module.
This module, by no means, is supposed to reliably recognize all NSFW images. Its main purpose is quickly classifying provided images and supporting humans in better moderating a server.
The module itself will not store or expose any sexually explicit images. The output will not contain a direct link to the original image, and a censored (low resolution, blurred) version of the image will be locally cached and used to refer to the original image.
Here’s an example of an output of this command, and the corresponding censored image:
For those of you with a background in image processing - yes, Lenna is actually flagged as NSFW with a confidence score of 81.9%!
If you don’t know what I’m talking about, refer to this Wikipedia page.
!nsfwcheck (image URL, or image as a message attachment)
Submits an image against the GantMan’s Inception v3 Keras Model for NSFW detection (as explained above) and returns a detailed output about the classification.
!nsfwcache (cache ID)
Recalls an image classification output by its cache ID (as given in the footer of the !nsfwcheck command.
!nsfwthreshold [new threshold, or "-"]
While the classification scores given to an image cannot be tuned, each server can choose its own NSFW threshold (the sum of NSFW-related scores over which an image is considered NSFW).
The new threshold is an integer within the range
[0, 100], inclusive of
0 (treat all images as NSFW) and
100 (only treat an image as NSFW if the model recognize it as having no-SFW components - which is highly unlikely, hence basically meaning “treat no images as NSFW”).
Running the command with
- as argument will reset the server threshold to the global, default threshold of 60%.
Running the command with no arguments will show the current value for the server.
!nsfwthreshold 80 !nsfwthreshold - !nsfwthreshold
!shorturl (long URL)
Converts a long URL into a short URL using TinyURL as shortening service.
URLs that are already known to the bot will be fetched from the local cache. Users will have the ability to request an additional online check by clicking on the available reaction if the fetched URL is invalid.
According to the TinyURL website, their short URLs never expire. This means a new request will probably still give the same result from the online cache.