Skip to main content

opennsfw-standalone

License: MIT PyPi CircleCI

A small library for intergrating yahoo/open_nsfw model directly into an application.

This library uses the ONNX Runtime to run inference against Open NSFW. The conversion from the original Caffe model provided by yahoo/open_nsfw was done as following:

  1. Convert from Caffe to Tensorflow using ethereon/caffe-tensorflow.
  2. Convert from Tensorflow to ONNX using onnx/tensorflow-onnx.

The image pre-processing routine was approximated and is implemented using Pillow.

Prerequisites

  • ONNX Runtime 1.x
  • NumPy 1.x

Installation

$ pip install opennsfw-standalone

Usage

Python

import sys

from opennsfw_standalone import OpenNSFWInferenceRunner


inference_runner = OpenNSFWInferenceRunner.load()

for image_filename in sys.argv[1:]:
    with open(image_filename, "rb") as fp:
        nsfw_score = inference_runner.infer(fp.read())
        print(image_filename, nsfw_score)

CLI

$ python -m opennsfw_standalone myimage.jpeg mysecondimage.jpeg
myimage.jpg 0.9997739
mysecondimage.jpg 0.9984438

License

Although this repository is MIT licensed, the model itself is subject to the BSD 2-Clause license Yahoo provided.

Metadata

Release files for opennsfw-standalone 0.0.6

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Built distribution (wheel)

Table of built distributions (wheels) for opennsfw-standalone 0.0.6
File Interpreter ABI Platform Actions
opennsfw_standalone-0.0.6-py3-none-any.whl Python 3 none any Details for opennsfw_standalone-0.0.6-py3-none-any.whl

Release files / opennsfw_standalone-0.0.6-py3-none-any.whl

Download URL opennsfw_standalone-0.0.6-py3-none-any.whl
Size 21.9 MB
Tags Python 3
SHA-256 checksum
How to use checksums
e3357078a9f18c40d5c254f1396f47dcd46a2fbc819138b81f72087e17bec259
BLAKE2b-256 checksum
How to use checksums
fb9ea9b10a114931f52afff1e4b6af162b4f7cad59b01e02e54bd3e9ac67e6be
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/3.4.1 importlib_metadata/3.7.3 pkginfo/1.7.0 requests/2.25.1 requests-toolbelt/0.9.1 tqdm/4.59.0 CPython/3.8.2

Security for opennsfw-standalone 0.0.6

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

No provenance found

None of the files in this release were uploaded with provenance metadata.

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page