Skip to content

Commit

Permalink
1.0.0
Browse files Browse the repository at this point in the history
  • Loading branch information
zhulmin committed Jul 27, 2020
1 parent 2742d5e commit 8e26899
Show file tree
Hide file tree
Showing 21 changed files with 492 additions and 287 deletions.
14 changes: 10 additions & 4 deletions Example/NsfwImgDetector.xcodeproj/project.pbxproj
Original file line number Diff line number Diff line change
Expand Up @@ -212,10 +212,12 @@
TargetAttributes = {
607FACCF1AFB9204008FA782 = {
CreatedOnToolsVersion = 6.3.1;
DevelopmentTeam = 9455JH33DA;
LastSwiftMigration = 0900;
};
607FACE41AFB9204008FA782 = {
CreatedOnToolsVersion = 6.3.1;
DevelopmentTeam = 9455JH33DA;
LastSwiftMigration = 0900;
TestTargetID = 607FACCF1AFB9204008FA782;
};
Expand Down Expand Up @@ -419,7 +421,7 @@
GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE;
GCC_WARN_UNUSED_FUNCTION = YES;
GCC_WARN_UNUSED_VARIABLE = YES;
IPHONEOS_DEPLOYMENT_TARGET = 9.3;
IPHONEOS_DEPLOYMENT_TARGET = 8.0;
MTL_ENABLE_DEBUG_INFO = YES;
ONLY_ACTIVE_ARCH = YES;
SDKROOT = iphoneos;
Expand Down Expand Up @@ -465,7 +467,7 @@
GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE;
GCC_WARN_UNUSED_FUNCTION = YES;
GCC_WARN_UNUSED_VARIABLE = YES;
IPHONEOS_DEPLOYMENT_TARGET = 9.3;
IPHONEOS_DEPLOYMENT_TARGET = 8.0;
MTL_ENABLE_DEBUG_INFO = NO;
SDKROOT = iphoneos;
SWIFT_OPTIMIZATION_LEVEL = "-Owholemodule";
Expand All @@ -478,10 +480,11 @@
baseConfigurationReference = 6D670987F038020FB32789BC /* Pods-NsfwImgDetector_Example.debug.xcconfig */;
buildSettings = {
ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon;
DEVELOPMENT_TEAM = 9455JH33DA;
INFOPLIST_FILE = NsfwImgDetector/Info.plist;
LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks";
MODULE_NAME = ExampleApp;
PRODUCT_BUNDLE_IDENTIFIER = "org.cocoapods.demo.$(PRODUCT_NAME:rfc1034identifier)";
PRODUCT_BUNDLE_IDENTIFIER = org.cocoapods.demo;
PRODUCT_NAME = "$(TARGET_NAME)";
SWIFT_SWIFT3_OBJC_INFERENCE = Default;
SWIFT_VERSION = 4.0;
Expand All @@ -493,10 +496,11 @@
baseConfigurationReference = 6D83B76EC40841874AB5261E /* Pods-NsfwImgDetector_Example.release.xcconfig */;
buildSettings = {
ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon;
DEVELOPMENT_TEAM = 9455JH33DA;
INFOPLIST_FILE = NsfwImgDetector/Info.plist;
LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks";
MODULE_NAME = ExampleApp;
PRODUCT_BUNDLE_IDENTIFIER = "org.cocoapods.demo.$(PRODUCT_NAME:rfc1034identifier)";
PRODUCT_BUNDLE_IDENTIFIER = org.cocoapods.demo;
PRODUCT_NAME = "$(TARGET_NAME)";
SWIFT_SWIFT3_OBJC_INFERENCE = Default;
SWIFT_VERSION = 4.0;
Expand All @@ -507,6 +511,7 @@
isa = XCBuildConfiguration;
baseConfigurationReference = DB94A42DB3B5360086DEAA27 /* Pods-NsfwImgDetector_Tests.debug.xcconfig */;
buildSettings = {
DEVELOPMENT_TEAM = 9455JH33DA;
FRAMEWORK_SEARCH_PATHS = (
"$(PLATFORM_DIR)/Developer/Library/Frameworks",
"$(inherited)",
Expand All @@ -529,6 +534,7 @@
isa = XCBuildConfiguration;
baseConfigurationReference = 33FEC668FBA0C22CF24FA3CB /* Pods-NsfwImgDetector_Tests.release.xcconfig */;
buildSettings = {
DEVELOPMENT_TEAM = 9455JH33DA;
FRAMEWORK_SEARCH_PATHS = (
"$(PLATFORM_DIR)/Developer/Library/Frameworks",
"$(inherited)",
Expand Down
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
21 changes: 21 additions & 0 deletions Example/NsfwImgDetector/Images.xcassets/1.imageset/Contents.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
{
"images" : [
{
"filename" : "1.png",
"idiom" : "universal",
"scale" : "1x"
},
{
"idiom" : "universal",
"scale" : "2x"
},
{
"idiom" : "universal",
"scale" : "3x"
}
],
"info" : {
"author" : "xcode",
"version" : 1
}
}
6 changes: 6 additions & 0 deletions Example/NsfwImgDetector/Images.xcassets/Contents.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
{
"info" : {
"author" : "xcode",
"version" : 1
}
}
38 changes: 35 additions & 3 deletions Example/NsfwImgDetector/ViewController.swift
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,8 @@
//

import UIKit
import NsfwImgDetector


class ViewController: UIViewController {

Expand All @@ -15,10 +17,40 @@ class ViewController: UIViewController {
// Do any additional setup after loading the view, typically from a nib.
}

override func didReceiveMemoryWarning() {
super.didReceiveMemoryWarning()
// Dispose of any resources that can be recreated.
override func touchesBegan(_ touches: Set<UITouch>, with event: UIEvent?) {

guard let img = UIImage(named: "1") else { return }
if #available(iOS 11.0, *) {
filter(image: img)
} else {
// Fallback on earlier versions
}
}


@available(iOS 11.0, *)
func filter(image:UIImage) {





let detector = NsfwImgDetector()

detector.check(image: image) { (isNoSafe, confidence) in
print("isNoSafe:\(isNoSafe) confidence:\(confidence)")
if isNoSafe == false {
//safe
}else if (confidence > 0.9) {
// porn
}else if (confidence > 0.5) {
// sexy picture, may porn
}else {
// sexy picture
}
}
}


}

4 changes: 2 additions & 2 deletions Example/Podfile.lock
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,8 @@ EXTERNAL SOURCES:
:path: "../"

SPEC CHECKSUMS:
NsfwImgDetector: f19769e20c5f3fa156bf9e5798fa9f99a5fcb3ed
NsfwImgDetector: 5dd5536bbba5e97792a79a9cb012d382a44f01f7

PODFILE CHECKSUM: ade6d80c4b9d3253be66e8aa0dd617374ae75a0d

COCOAPODS: 1.7.5
COCOAPODS: 1.9.3
17 changes: 10 additions & 7 deletions Example/Pods/Local Podspecs/NsfwImgDetector.podspec.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 2 additions & 2 deletions Example/Pods/Manifest.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Loading

0 comments on commit 8e26899

Please sign in to comment.