def bot_init(self): ############################ # REQUIRED: LOGIN DETAILS! # ############################ self.config['api_key'] = os.environ['TWITTER_API_KEY'] self.config['api_secret'] = os.environ['TWITTER_API_SECRET'] self.config['access_key'] = os.environ['TWITTER_ACCESS_KEY'] self.config['access_secret'] = os.environ['TWITTER_ACCESS_SECRET'] ###################################### # SEMI-OPTIONAL: OTHER CONFIG STUFF! # ###################################### # how often to tweet, in seconds self.config['tweet_interval'] = 30 * 60 # default: 30 minutes # only include bot followers (and original tweeter) in @-replies self.config['reply_followers_only'] = True # fav any tweets that mention this bot? self.config['autofav_mentions'] = False # fav any tweets containing these keywords? self.config['autofav_keywords'] = [] # follow back all followers? self.config['autofollow'] = True ########################################### # CUSTOM: your bot's own state variables! # ########################################### self.register_custom_handler(openshift_wake_up, 60 * 60 * 12) self.face_regions = partial( core.face_regions, core.load_face_detector()) self.face_recognizer = FaceRecognizer() self.store = Store()
import core import facerec if __name__ == '__main__': detector = core.load_face_detector() recognizer = facerec.FaceRecognizer() img = core.prepare_image('resources/wohanley/panda.jpg') for (x, y, width, height) in core.face_regions(detector, img): print recognizer.recognize_face(img[y: y + height, x: x + width])