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.4.tar.gz
(44.3 MB
view hashes)
Built Distribution
Close
Hashes for opennsfw-standalone-0.0.4.tar.gz
Algorithm | Hash digest | |
---|---|---|
SHA256 | 11500eed8deace8a8e2e4ab40e85499bd688074b9207ba67ce3fbadc8fb5d850 |
|
MD5 | 99948a49109199f94f1fe5bd768c4563 |
|
BLAKE2b-256 | 5df264398fa5386986b314695a82008ebc33da067a175b7a59d7a4813b324f56 |
Close
Hashes for opennsfw_standalone-0.0.4-py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 7b1c03b8442ab387408f63c5e99a6dd9969901b9fd0318d423461fe946a1d991 |
|
MD5 | d77b74927213566ffe12ebf566a37bf3 |
|
BLAKE2b-256 | 82f86119b6f0206a778ef3d0f3f1673718d5b580e527b40796bf1dddc7fa727e |