Skip to content
This repository has been archived by the owner on Aug 21, 2019. It is now read-only.

Commit

Permalink
remove face_detection_proc
Browse files Browse the repository at this point in the history
  • Loading branch information
afeld committed May 1, 2016
1 parent 07b1808 commit 741bb17
Showing 1 changed file with 1 addition and 20 deletions.
21 changes: 1 addition & 20 deletions lib/mustachio.rb
Original file line number Diff line number Diff line change
Expand Up @@ -33,22 +33,6 @@ def setup
@@mustaches = staches
end

# block should take |File|
# and return hash with keys 'mouth_left', 'mouth_right', 'nose' (and optionally 'mouth_center')
# with values containing keys 'x' and 'y'
# whose values are between 0 and 100
def setup_face_detection &block
@@face_detection_proc = block
end

def setup_face_detector
require File.join(File.dirname(__FILE__), 'mustachio', 'face_detector')

self.setup_face_detection do |file|
Mustachio::FaceDetector.run(file)
end
end

def face_data(file_or_job)
file = case file_or_job
when Dragonfly::Job
Expand All @@ -62,10 +46,7 @@ def face_data(file_or_job)
raise ArgumentError, "A #{file_or_job.class} is not a valid argument for #face_data. Please provide a File or a Dragonfly::Job."
end

# default to using Google Cloud Vision API for face detection
self.setup_face_detector unless defined? @@face_detection_proc

@@face_detection_proc.call file
Mustachio::FaceDetector.run(file)
end

def face_data_as_px(file_or_job, width, height)
Expand Down

0 comments on commit 741bb17

Please sign in to comment.