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.3.tar.gz
(44.3 MB
view hashes)
Built Distribution
Close
Hashes for opennsfw-standalone-0.0.3.tar.gz
Algorithm | Hash digest | |
---|---|---|
SHA256 | 0575af27569089ee0ddc8c6d441ad34ed3bee6fa04d234a1c6b6c87d3d8720ef |
|
MD5 | 14426e17cd483e262038b0f22c27a8a3 |
|
BLAKE2b-256 | db5165b4b37d8d264523380bdc4c47f4f86234891c43d380869cdfc00f4f8517 |
Close
Hashes for opennsfw_standalone-0.0.3-py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | d31939260c0d4e9b585e5fd09a74755b0dc6817889dce7d24e418364b6dcd2b2 |
|
MD5 | def2cb8149877a507bc96d8cb2c92e06 |
|
BLAKE2b-256 | e20fd0dccf7f7eae3275be61129cdeeaac1472dfb6bacb70b29593056dddc323 |