Stand-alone wrapper for Yahoo's OpenNSFW model using Tensorflow.
Project description
opennsfw-standalone
A small library for intergrating yahoo/open_nsfw
model directly into an application.
This library wraps an Tensorflow version of yahoo/open_nsfw
, provided by tensorflow-open_nsfw
. The TensorFlow model was exported so there is no direct dependency on yahoo/open_nsfw
or tensorflow-open_nsfw
.
Prerequisites
- Tensorflow 2.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.
Project details
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
opennsfw-standalone-0.0.2.tar.gz
(44.3 MB
view hashes)
Built Distribution
Close
Hashes for opennsfw-standalone-0.0.2.tar.gz
Algorithm | Hash digest | |
---|---|---|
SHA256 | 91e97840feff9f2df8fb1a491e425daa1deaa9520c8a1a91d9fe78c6d6aed9d9 |
|
MD5 | 86dffc1921fd42af2811ecacc33f4c98 |
|
BLAKE2b-256 | 2cb33274e4c93bcea8d1e0ed1e6a9dbdc77f4840a61ab13b9f8701bd011be291 |
Close
Hashes for opennsfw_standalone-0.0.2-py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | ee83a1a2e0e746d775cd44576e1ae5ac285a1e61954980d71cb16758be517b0b |
|
MD5 | 40c5c14b9d1bdb5f4d331a85b386ef82 |
|
BLAKE2b-256 | 3615ec167ba92a604314fa2599f43ab1ae34ba9eb8da78885406d8e7a102821e |