Coder Social home page Coder Social logo

m1chlcz / nsfw_sherlock Goto Github PK

View Code? Open in Web Editor NEW
8.0 2.0 3.0 161 KB

Simple drop in API to determine if image is NSFW using TensorFlow

License: GNU Affero General Public License v3.0

Dockerfile 9.41% Go 87.38% Shell 3.21%
docker go-fiber golang grpc ocr-recognition tensorflow go machine-learning nsfw-recognition nsfw-classifier

nsfw_sherlock's Introduction

NSFW Sherlock

Build with GO and TensorFlow

License: AGPL Go Report Card GoDoc GoDoc

Simple drop-in API for classifying images for NSFW content.

It can determine if picture is NSFW as well as if text on picture is NSFW

Both HTTP and GRPC APIs are supported

Use docker to run NSFW Sherlock

UPDATE 0.0.0.4:

Now you can use additional API, which will give you labels (Drawings, Neutral, Hentai, Porn, Sexy) and its values directly. Implemented on both Web and GRPC APIs. For Web: /pic/labels For GRPC: Please refer to protofile in ./proto

Usage with Git Clone:

git clone https://github.com/M1chlCZ/nsfw_sherlock nsfw_sherlock
cd nsfw_sherlock
docker build -t nsfwsherlock .

GRPC:
docker run -e APP_ENV=grpc -p 4000:4000 nsfwsherlock 
(proto file in /proto)

HTTP:
docker run -e APP_ENV=http -p 4000:4000 nsfwsherlock
(POST /pic/check) req: {"base64": "base64 string of image", filename: "image.jpg"}
res: {
    "status":   "ok", 
    "message":  "success", 
    "nsfwText": true/false, 
    "nsfwPic":  true/false
}

(POST /pic/labels) req: {"base64": "base64 string of image", filename: "image.jpg"}, 
res: {
    "status":   "ok",
	"message":  "success",
	"drawings": 0.0,
	"hentai":   0.0,
	"neutral":  0.0,
	"porn":     0.0,
	"sexy":     0.0,
	"nsfwText": true/false,
  },

---------------------------------------------

LOADING YOUR OWN BAD WORDS:
docker run -e APP_ENV=grpc/http  -v /path/to/your/host/bad_words.txt:/bad_words.txt -p 4000:4000 nsfwsherlock

If you need tighten up or loosen up NSFW detection rules, you can do so in nsfw/nsfw.go file or use /pic/labels endpoint

Usage with Docker Hub:

docker pull m1chl/nsfw-sherlock

GRPC:
docker run -e APP_ENV=grpc -p 4000:4000 m1chl/nsfw-sherlock 
(proto file in /proto)

HTTP:
docker run -e APP_ENV=http -p 4000:4000 m1chl/nsfw-sherlock
(POST /pic/check) req: {"base64": "base64 string of image", filename: "image.jpg"}
res: {
    "status":   "ok", 
    "message":  "success", 
    "nsfwText": true/false, 
    "nsfwPic":  true/false
}

(POST /pic/labels) req: {"base64": "base64 string of image", filename: "image.jpg"}, 
res: {
    "status":   "ok",
	"message":  "success",
	"drawings": 0.0,
	"hentai":   0.0,
	"neutral":  0.0,
	"porn":     0.0,
	"sexy":     0.0,
	"nsfwText": true/false,
  },


---------------------------------------------

LOADING YOUR OWN BAD WORDS:
docker run -e APP_ENV=grpc/http  -v /path/to/your/host/bad_words.txt:/bad_words.txt -p 4000:4000 nsfwsherlock

Credits:

Model: https://github.com/GantMan/nsfw_model

Tensorflow-GO: https://github.com/galeone/tfgo

OCR: https://github.com/otiai10/gosseract

nsfw_sherlock's People

Contributors

m1chlcz avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.