{"id":15067713,"url":"https://github.com/hoyaaaa/nsfw_detector_flutter","last_synced_at":"2025-07-12T20:31:55.480Z","repository":{"id":247084849,"uuid":"825007238","full_name":"hoyaaaa/nsfw_detector_flutter","owner":"hoyaaaa","description":"A Flutter package to detect NSFW 🔞 (Not Safe For Work / NUDE / adults) contents and classify SAFE 🛡️ contents without downloading or setting any assets","archived":false,"fork":false,"pushed_at":"2024-09-29T10:40:50.000Z","size":21717,"stargazers_count":1,"open_issues_count":0,"forks_count":2,"subscribers_count":1,"default_branch":"main","last_synced_at":"2024-10-14T02:42:17.738Z","etag":null,"topics":["adult","dart","flutter","image-processing","mobile-development","nsfw","nsfw-detection","open-source","safe-content","tensoflow-lite"],"latest_commit_sha":null,"homepage":"https://pub.dev/packages/nsfw_detector_flutter","language":"Dart","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/hoyaaaa.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG.md","contributing":null,"funding":".github/FUNDING.yml","license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null},"funding":{"github":null,"patreon":null,"open_collective":null,"ko_fi":"hoyaaaa","tidelift":null,"community_bridge":null,"liberapay":null,"issuehunt":null,"lfx_crowdfunding":null,"polar":null,"buy_me_a_coffee":"hoya.develop","custom":null}},"created_at":"2024-07-06T14:01:02.000Z","updated_at":"2024-09-29T10:40:49.000Z","dependencies_parsed_at":"2024-07-17T11:56:27.240Z","dependency_job_id":null,"html_url":"https://github.com/hoyaaaa/nsfw_detector_flutter","commit_stats":null,"previous_names":["hoyaaaa/nsfw_detector_flutter"],"tags_count":4,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/hoyaaaa%2Fnsfw_detector_flutter","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/hoyaaaa%2Fnsfw_detector_flutter/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/hoyaaaa%2Fnsfw_detector_flutter/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/hoyaaaa%2Fnsfw_detector_flutter/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/hoyaaaa","download_url":"https://codeload.github.com/hoyaaaa/nsfw_detector_flutter/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":225834366,"owners_count":17531470,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["adult","dart","flutter","image-processing","mobile-development","nsfw","nsfw-detection","open-source","safe-content","tensoflow-lite"],"created_at":"2024-09-25T01:26:33.601Z","updated_at":"2025-07-12T20:31:55.469Z","avatar_url":"https://github.com/hoyaaaa.png","language":"Dart","funding_links":["https://ko-fi.com/hoyaaaa","https://buymeacoffee.com/hoya.develop"],"categories":[],"sub_categories":[],"readme":"# 🙈 nsfw_detector_flutter\n\n\u003cp\u003e\n    \u003ca href=\"https://pub.dartlang.org/packages/nsfw_detector_flutter\"\u003e\n        \u003cimg src=\"https://img.shields.io/pub/v/nsfw_detector_flutter\" alt=\"pub package\"\u003e\n    \u003c/a\u003e\n    \u003ca href=\"https://pub.dartlang.org/packages/nsfw_detector_flutter\"\u003e\n        \u003cimg src=\"https://img.shields.io/pub/likes/nsfw_detector_flutter\" alt=\"pub package\"\u003e\n    \u003c/a\u003e\n    \u003ca href=\"https://pub.dartlang.org/packages/nsfw_detector_flutter\"\u003e\n        \u003cimg src=\"https://img.shields.io/pub/popularity/nsfw_detector_flutter\" alt=\"pub package\"\u003e\n    \u003c/a\u003e\n    \u003ca href=\"https://img.shields.io/github/license/hoyaaaa/nsfw_detector_flutter\"\u003e\n        \u003cimg src=\"https://img.shields.io/github/license/hoyaaaa/nsfw_detector_flutter\" alt=\"License\"\u003e\n    \u003c/a\u003e\n    \u003ca href=\"https://github.com/hoyaaaa/nsfw_detector_flutter/issues\"\u003e\n        \u003cimg src=\"https://img.shields.io/github/issues/hoyaaaa/nsfw_detector_flutter\" alt=\"GitHub issues\"\u003e\n    \u003c/a\u003e\n\u003c/p\u003e\n\nA Flutter package to detect NSFW 🔞 (Not Safe For Work / NUDE / adults) contents and classify SAFE 🛡️ contents __without downloading or setting any assets__\n\n## 🛠️ Installation\n\n```sh\nflutter pub add nsfw_detector_flutter\n```\n\nThat's it! You don't need any assets. 😎\n\n## 🏃 Simple usage\n\n```dart\nimport 'package:nsfw_detector_flutter/nsfw_detector_flutter.dart';\n\nFile imageFile = File('path/to/image.jpg');\nNsfwDetector detector = await NsfwDetector.load();\nNsfwResult? result = await detector.detectNSFWFromFile(imageFile);\n\n// whether it is over threshold (default: 0.7)\nprint(\"NSFW detected: ${result?.isNsfw}\");\n// float value from 0 to 1\nprint(\"NSFW score: ${result?.score}\");\n```\n\n## 📙 Usage\n\n### Load and initialize the detector\n\nThe `NsfwDetector` can be initialized with default parameters:\n\n```dart\nNsfwDetector detector = await NsfwDetector.load(); // default threshold: 0.7\n```\n\n| Parameter     | Type    | Default | Description                                                   |\n|---------------|---------|---------|---------------------------------------------------------------|\n| `threshold`   | Float   | 0.7     | The threshold to classify an image as NSFW                    |                              |\n\n### NsfwResult\n\nThe `NsfwResult` class contains the following properties:\n\n| Parameter     | Type    | Description                                                   |\n|---------------|-------- |---------------------------------------------------------------|\n| `score`       | Float   | The NSFW score of the image (0 to 1, higher indicates more NSFW) |\n| `isNsfw`      | Boolean | Indicates if the image is classified as NSFW based on the threshold |\n\n### Detect NSFW content\n\n```dart\n// from bytes\nfinal ByteData data = await rootBundle.load('assets/nsfw.jpeg');\nfinal Uint8List imageData = data.buffer.asUint8List();\n\nNsfwResult? result = await detector.detectNSFWFromBytes(imageData);\n\n// from file\nFile imageFile = File('path/to/image.jpg');\nNsfwResult? result = await detector.detectNSFWFromFile(imageFile);\n\n// from image\nimport 'package:image/image.dart' as img;\n\nimg.Image image = img.decodeImage(File('path/to/image.jpg').readAsBytesSync())!;\nNsfwResult? result = await detector.detectNSFWFromImage(image);\n```\n\n## ⚠️ Warnings\n\n### iOS\n\nIf there are issues related to the library on iOS and it doesn't work, check the following setting in XCode:\n\n1. Ensure that **XCode \u003e Build Settings \u003e Deployment \u003e Strip Linked Product** is set to **No**.\n\n### Android\n\n#### 1.\tMin SDK Version:\n\nThis package uses the `tflite_flutter` package, so the Android `minSdkVersion` must be set to 26 or higher. Check and update the following in your `android/app/build.gradle` file:\n\n```gradle\nandroid {\n    defaultConfig {\n        minSdkVersion 26\n    }\n}\n```\n\n#### 2.\tProGuard / R8 Configuration:\n\nIf you encounter issues during release builds due to R8 (ProGuard), ensure that the following rules are added to your `android/app/proguard-rules.pro` file:\n\n```pro\n# TensorFlow Lite GPU Delegate\n-keep class org.tensorflow.lite.gpu.GpuDelegateFactory$Options { *; }\n-dontwarn org.tensorflow.lite.gpu.GpuDelegateFactory$Options\n```\n\nAlso, verify that ProGuard or R8 is enabled in your `android/app/build.gradle` file:\n\n```gradle\nbuildTypes {\n    release {\n        minifyEnabled true\n        shrinkResources true\n        proguardFiles getDefaultProguardFile('proguard-android-optimize.txt'), 'proguard-rules.pro'\n    }\n}\n```\n\n## 🧪 Test\n\nFor information on how to run integration tests for this package, please refer to the [example README](example/README.md).\n\n## 💳 License\n\nThis project is licensed under the MIT License - see the [LICENSE](LICENSE) file for details.\n\n### Model Information\n\nThe default model used in this package is referenced from the [open_nsfw_android](https://github.com/devzwy/open_nsfw_android) repository, which is a port of the [yahoo/open_nsfw](https://github.com/yahoo/open_nsfw) model. This package complies with the license terms of the yahoo/open_nsfw repository.\n\n### BSD 3-Clause License\n\n```\nCopyright 2016, Yahoo Inc.\n\nRedistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met:\n\nRedistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer.\nRedistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution.\nNeither the name of the Yahoo Inc. nor the names of its contributors may be used to endorse or promote products derived from this software without specific prior written permission.\nTHIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS \"AS IS\" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.\n```\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fhoyaaaa%2Fnsfw_detector_flutter","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fhoyaaaa%2Fnsfw_detector_flutter","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fhoyaaaa%2Fnsfw_detector_flutter/lists"}