Clone this repo:

Branches

  1. 4fccc4f Add .gitreview by Christian Aistleitner · 4 years ago master
  2. 6818a57 Blubberfile: Fix entrypoints by Michael Holloway · 4 years, 9 months ago
  3. a524720 Add unit tests by Michael Holloway · 4 years, 9 months ago
  4. d8ab8de Oops: Fix logging config by Michael Holloway · 4 years, 9 months ago
  5. 23abde4 Add basic Prometheus metrics support by Michael Holloway · 4 years, 9 months ago

nsfwoid

This is a fork of the open_nsfw-- project, updated for use in Wikimedia production. The project is originally based on Yahoo's open_nsfw.

It provides image NSFW likelihood scoring as a web service.

Running the service

Quick start

To run the service as a local Python process:

python3 app.py

Dockerization via Blubber

Dockerfile generation and Docker image creation is supported with Wikimedia's Blubber tool. See the project documentation for details.

Note: Currently broken without patching Blubber; see https://phabricator.wikimedia.org/T227919.

The Blubber fork branch at https://github.com/mdholloway/blubber/tree/python-fix contains the commit adding the use-system-flag declaration used in the Blubberfile here, cherry-picked on top of the latest Debian release.

API usage

POST the url of an image to /v1/score, and the service will fetch it and return the probability that it's NSFW, expressed as a floating point number between 0 and 1.

curl -d 'url=https://upload.wikimedia.org/wikipedia/commons/thumb/8/80/Wikipedia-logo-v2.svg/263px-Wikipedia-logo-v2.svg.png' localhost:8080/v1/score
0.018645038828253746