Class: String

Inherits:
Object
  • Object
show all
Defined in:
lib/isporn.rb

Instance Method Summary collapse

Instance Method Details

#is_porn?Boolean

Returns:

  • (Boolean)


36
37
38
39
40
41
42
43
44
45
46
47
# File 'lib/isporn.rb', line 36

def is_porn?
  temp_fn = "_temp.jpeg"
  image =  MiniMagick::Image.open(self)
  image.resize "270x270"
  image.format "jpeg"
  image.write temp_fn
  res = Isporn.exadeep_api_rest_post temp_fn
  File.delete temp_fn
  
  j=JSON.parse(res)
  j["results"].first["scores"].first["label"]
end

#is_porn_jsonObject



50
51
52
# File 'lib/isporn.rb', line 50

def is_porn_json
  Isporn.exadeep_api_rest_post self
end

#isporn?Boolean

Returns:

  • (Boolean)


32
33
34
# File 'lib/isporn.rb', line 32

def isporn?
  is_porn?
end