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.1.tar.gz
(44.3 MB
view hashes)
Built Distribution
Close
Hashes for opennsfw-standalone-0.0.1.tar.gz
Algorithm | Hash digest | |
---|---|---|
SHA256 | afc920815e48d39440702fc261f341ac0ade97a479a227c6c3e2eba237e4095c |
|
MD5 | 07e739d608fbcc0658b2a97f39649463 |
|
BLAKE2b-256 | 0e8ee9bed802521ffbce831eb7cf18a4f4e76d6f070fa718aad283225febc1a0 |
Close
Hashes for opennsfw_standalone-0.0.1-py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | e157c62a213f5e3274194faa9232e94979fc9315e4d90966ce6c2bac1d1466a9 |
|
MD5 | 7c605b554398ec42ad6e777d7b7434fe |
|
BLAKE2b-256 | 900132753ef4abefb774d16b12ef9fede60e6a22e9364aee47dc3e57e7aed1c0 |