Skip to content

Serveny/nsfw-check-server

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

18 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

NSFW Check Server

A web server that checks if an image is NSFW.

It's just the NSFW crate (https://github.com/fyko/nsfw) with an actix web server.

API

Public requests

Function Method URL Parameters Return format Returns
Check image from URL GET /check url as query parameter to read image from JSON Classification result
Upload and check image POST /check image: Image as form file JSON Classification result
Is image allowed (=not NSFW) GET /is_allowed url as query parameter to read image from JSON boolean
Is image allowed (=not NSFW) POST /is_allowed image: Image as form file JSON boolean

Types

  • Classifications result example:
[
  { "metric": "Drawings", "score": 0.00016305158 },
  { "metric": "Hentai", "score": 4.0540633e-7 },
  { "metric": "Neutral", "score": 0.9997923 },
  { "metric": "Porn", "score": 0.0000022404822 },
  { "metric": "Sexy", "score": 0.000042102398 }
]

Example requests

See under examples/requests.html for an interactive example.

Warning

Many official sites protect their images from web scraping. A typical error for this would be Format error decoding Jpeg: Error parsing image. Illegal start bytes:506C. For the GET methods use sources you know you can use.

  • GET: http://localhost:6969/check?url=https://picsum.photos/id/1/200/300

  • POST: http://localhost:6969/check with form data

  • GET: http://localhost:6969/is_allowed?url=https://picsum.photos/id/1/200/300

  • POST: http://localhost:6969/is_allowed with form data

Docker Hub (easiest)

  1. Pull: docker pull serveny/nsfw-check-server (Build available for arm & amd)
  2. Run: docker run -p 6969:6969 --rm --name ncs serveny/nsfw-check-server

Docker

  1. Download this repository and open terminal inside the repository directory
  2. Build: docker build -t nsfw-check-server .
  3. Run: docker run -p 6969:6969 --rm --name ncs nsfw-check-server

About

A web server that checks if an image is NSFW

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors