alisoleimani / nsfw-detector
nsfw detector php
v1.0.2
2022-06-21 13:19 UTC
Requires
- ext-json: *
This package is auto-updated.
Last update: 2024-09-21 19:25:06 UTC
README
NSFW (Not Safe for Work) Detector 实际上是一个 Python 脚本,但已集成到 PHP 中
安装
Python 安装
pip install --upgrade TensorFlow pip install nsfw-detector
PHP 安装
composer require alisoleimani/nsfw-detector
用法/示例
基本用法
$filePath = "path-to-file/file.png"; $data = NSFW::predict($filePath); // data will be like // {'drawings': 0.0024894224479794502, 'hentai': 0.0009175422019325197, 'neutral': 0.9905469417572021, 'porn': 0.00509273586794734, 'sexy': 0.0009534107521176338} // The higher these values, the more likely the photo is to be unsafe
别慌张!您可以使用 detect 方法获取布尔值,然后判断图片是否安全
$filePath = "path-to-file/file.png"; $situation = NSFW::detect($filePath); // if $sitation is true it means image is not safe and if its false image will be secure