npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2024 – Pkg Stats / Ryan Hefner

isadult

v1.0.4

Published

Machine learning algorithm written in JS to check if an image contains adult content

Downloads

5

Readme

IsAdult

IsAdult is a script that detects whether or not an image is an adult image based on a given image element.

Based on ml5, which is a machine learning framework written in JavaScript with TensorFlow, isAdult aim is to be as accurate as possible in its detection.

IsAdult is very easy to use, just add the isAdult.js or isAdult.min.js file into your project and you're done!

IsAdult has only one function for now, which is called checkAdultImage. This function should receive one parameter, this parameter is the image HTML element where the image is shown. This function will return a promise so its response should be treated as such using then/catch or async/await. When the promise is resolved, the response object will contain a status and a msg properties. The status may contain 3 different statuses with a type of integer:

  • 1 - Image is clear and there is no risk of adult content shown
  • 2 - Low risk of adult content in this image
  • 3 - High risk of adult image showing. With this status the image most likely contains an adult content

The msg property is the verbal explanation of the status.

checkAdultImage function will expose NO_RISK_STATUS, MEDIUM_RISK_STATUS, HIGH_RISK_STATUS as properties, to allow users to check what the status was without knowing the underlying status code

A few notes before you start:

  • It is recommended that the <image> tag will contain a crossorigin="anonymous" attribute, especially if you are dealing with external image sources. Unfortunately, ml5 can not process images from sources that are blocking cross-origin access.
  • the <script src="isAdult.js"></script> should be placed at the bottom of the body tag and not in the header. Since this scripts also injects the ml5 script in the HTML, by adding this script to the body it will reserve the correct hierarchy of the scripts.

Example can be shown in the example.html file attached to this repository. A live example is also available here


Created by Shay Kintzlinger :)