isporn 0.0.1

Sign up to get free protection for your applications and to get access to all the features.
@@ -0,0 +1,7 @@
1
+ ---
2
+ SHA1:
3
+ metadata.gz: 84d1634557dbc258dc65cd730e8b198afbfc7819
4
+ data.tar.gz: 6ba9cd5ef3daedbdb5bb00dd6cbe8a684384d8bc
5
+ SHA512:
6
+ metadata.gz: f411767de3e2689d56b2a5ff2e392f450318441967f2f05c4f13d2078224166c2ae7844a6ae6b01ed8097bd8d735ae11e05cd47e92625b8c5477cef15796a233
7
+ data.tar.gz: 25173640f10f12cda281ec4e04fbe0d8bb10023d1a8b12c792cf1a6cd881f7f909cbc7a2966ab09cf2e963b88a7ecb75cca725d64b615d029475e4272fc434ff
@@ -0,0 +1,17 @@
1
+ *.gem
2
+ *.rbc
3
+ .bundle
4
+ .config
5
+ .yardoc
6
+ Gemfile.lock
7
+ InstalledFiles
8
+ _yardoc
9
+ coverage
10
+ doc/
11
+ lib/bundler/man
12
+ pkg
13
+ rdoc
14
+ spec/reports
15
+ test/tmp
16
+ test/version_tmp
17
+ tmp
data/Gemfile ADDED
@@ -0,0 +1,4 @@
1
+ source 'https://rubygems.org'
2
+
3
+ # Specify your gem's dependencies in isporn.gemspec
4
+ gemspec
@@ -0,0 +1,22 @@
1
+ Copyright (c) 2015 Yiling Cao
2
+
3
+ MIT License
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining
6
+ a copy of this software and associated documentation files (the
7
+ "Software"), to deal in the Software without restriction, including
8
+ without limitation the rights to use, copy, modify, merge, publish,
9
+ distribute, sublicense, and/or sell copies of the Software, and to
10
+ permit persons to whom the Software is furnished to do so, subject to
11
+ the following conditions:
12
+
13
+ The above copyright notice and this permission notice shall be
14
+ included in all copies or substantial portions of the Software.
15
+
16
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
17
+ EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
18
+ MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
19
+ NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
20
+ LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
21
+ OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
22
+ WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
@@ -0,0 +1,38 @@
1
+ # Isporn
2
+
3
+ Detect if your picture(s) is pornographic by AI, powered by https://exadeep.com.
4
+
5
+ Mid 2015 Correction rate > 90%
6
+
7
+ ## Installation
8
+
9
+ Add this line to your application's Gemfile:
10
+
11
+ gem 'isporn'
12
+
13
+ And then execute:
14
+
15
+ $ bundle
16
+
17
+ Or install it yourself as:
18
+
19
+ $ gem install isporn
20
+
21
+ ## Usage
22
+
23
+ require 'isporn'
24
+
25
+ '/path/to/test.jpg'.isporn?
26
+
27
+ returns:
28
+
29
+ # or => normal
30
+ # or => sexy
31
+ # or => porn
32
+
33
+ ## Limited free use
34
+
35
+ 1. only 1000 picture per IP per day.
36
+
37
+ ## Register and obtain your API key.
38
+ https://exadeep.com
@@ -0,0 +1 @@
1
+ require "bundler/gem_tasks"
@@ -0,0 +1,26 @@
1
+ # coding: utf-8
2
+ lib = File.expand_path('../lib', __FILE__)
3
+ $LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
4
+ require 'isporn/version'
5
+
6
+ Gem::Specification.new do |spec|
7
+ spec.name = "isporn"
8
+ spec.version = Isporn::VERSION
9
+ spec.authors = ["Yiling Cao"]
10
+ spec.email = ["yiling.cao@gmail.com"]
11
+ spec.summary = %q{ Auto Porn Detection}
12
+ spec.description = %q{Detect if your picture(s) is pornographic by AI, powered by https://exadeep.com.}
13
+ spec.homepage = "https://github.com/c2h2/isporn"
14
+ spec.license = "MIT"
15
+
16
+ spec.files = `git ls-files`.split($/)
17
+ spec.executables = spec.files.grep(%r{^bin/}) { |f| File.basename(f) }
18
+ spec.test_files = spec.files.grep(%r{^(test|spec|features)/})
19
+ spec.require_paths = ["lib"]
20
+
21
+ #spec.add_dependency "rest-client", ">= 1.8.0"
22
+ spec.add_runtime_dependency 'rest-client', '~> 1.8', '>= 1.8.0'
23
+
24
+ spec.add_development_dependency "bundler", "~> 1.5"
25
+ spec.add_development_dependency "rake", "~> 0"
26
+ end
@@ -0,0 +1,45 @@
1
+ require 'rest-client'
2
+ require 'json'
3
+
4
+ module Isporn
5
+ def self.exadeep_api_rest_post images
6
+ debug = false
7
+
8
+ if images.class == String
9
+ images=[images]
10
+ elsif images.class == Array
11
+ else
12
+ return nil
13
+ end
14
+ host = "https://exadeep.com"
15
+ RestClient.log = 'stdout' if debug
16
+ image_array = images.collect{|image| File.new(image, 'rb') }
17
+ request = RestClient::Request.new(
18
+ :method => :post,
19
+ :url => "#{host}/api/v1",
20
+ :payload => {
21
+ :api_key => 'exadeep_ruby_demo_key',
22
+ :multipart => true,
23
+ "images" => image_array
24
+ })
25
+ request.execute
26
+ end
27
+ end
28
+
29
+ class String
30
+
31
+ def isporn?
32
+ is_porn?
33
+ end
34
+
35
+ def is_porn?
36
+ res = Isporn.exadeep_api_rest_post self
37
+ j=JSON.parse(res)
38
+ j["results"].first["scores"].first["label"]
39
+ end
40
+
41
+
42
+ def is_porn_json
43
+ Isporn.exadeep_api_rest_post self
44
+ end
45
+ end
@@ -0,0 +1,3 @@
1
+ module Isporn
2
+ VERSION = "0.0.1"
3
+ end
metadata ADDED
@@ -0,0 +1,100 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: isporn
3
+ version: !ruby/object:Gem::Version
4
+ version: 0.0.1
5
+ platform: ruby
6
+ authors:
7
+ - Yiling Cao
8
+ autorequire:
9
+ bindir: bin
10
+ cert_chain: []
11
+ date: 2015-07-20 00:00:00.000000000 Z
12
+ dependencies:
13
+ - !ruby/object:Gem::Dependency
14
+ name: rest-client
15
+ requirement: !ruby/object:Gem::Requirement
16
+ requirements:
17
+ - - "~>"
18
+ - !ruby/object:Gem::Version
19
+ version: '1.8'
20
+ - - ">="
21
+ - !ruby/object:Gem::Version
22
+ version: 1.8.0
23
+ type: :runtime
24
+ prerelease: false
25
+ version_requirements: !ruby/object:Gem::Requirement
26
+ requirements:
27
+ - - "~>"
28
+ - !ruby/object:Gem::Version
29
+ version: '1.8'
30
+ - - ">="
31
+ - !ruby/object:Gem::Version
32
+ version: 1.8.0
33
+ - !ruby/object:Gem::Dependency
34
+ name: bundler
35
+ requirement: !ruby/object:Gem::Requirement
36
+ requirements:
37
+ - - "~>"
38
+ - !ruby/object:Gem::Version
39
+ version: '1.5'
40
+ type: :development
41
+ prerelease: false
42
+ version_requirements: !ruby/object:Gem::Requirement
43
+ requirements:
44
+ - - "~>"
45
+ - !ruby/object:Gem::Version
46
+ version: '1.5'
47
+ - !ruby/object:Gem::Dependency
48
+ name: rake
49
+ requirement: !ruby/object:Gem::Requirement
50
+ requirements:
51
+ - - "~>"
52
+ - !ruby/object:Gem::Version
53
+ version: '0'
54
+ type: :development
55
+ prerelease: false
56
+ version_requirements: !ruby/object:Gem::Requirement
57
+ requirements:
58
+ - - "~>"
59
+ - !ruby/object:Gem::Version
60
+ version: '0'
61
+ description: Detect if your picture(s) is pornographic by AI, powered by https://exadeep.com.
62
+ email:
63
+ - yiling.cao@gmail.com
64
+ executables: []
65
+ extensions: []
66
+ extra_rdoc_files: []
67
+ files:
68
+ - ".gitignore"
69
+ - Gemfile
70
+ - LICENSE.txt
71
+ - README.md
72
+ - Rakefile
73
+ - isporn.gemspec
74
+ - lib/isporn.rb
75
+ - lib/isporn/version.rb
76
+ homepage: https://github.com/c2h2/isporn
77
+ licenses:
78
+ - MIT
79
+ metadata: {}
80
+ post_install_message:
81
+ rdoc_options: []
82
+ require_paths:
83
+ - lib
84
+ required_ruby_version: !ruby/object:Gem::Requirement
85
+ requirements:
86
+ - - ">="
87
+ - !ruby/object:Gem::Version
88
+ version: '0'
89
+ required_rubygems_version: !ruby/object:Gem::Requirement
90
+ requirements:
91
+ - - ">="
92
+ - !ruby/object:Gem::Version
93
+ version: '0'
94
+ requirements: []
95
+ rubyforge_project:
96
+ rubygems_version: 2.2.2
97
+ signing_key:
98
+ specification_version: 4
99
+ summary: Auto Porn Detection
100
+ test_files: []