def get(self, name): start, end = dates_from_request(self.request) if start and end and start > end: self.abort(400) person = Person.get_by_key_name(name) if not person: self.abort(404) query = person.lunch_orders if start: query.filter("date >= ", start) if end: query.filter("date <= ", end) query.order("date") template_values = {'count': query.count(), 'query': query, 'person': person, 'updated_at': Scraper.all().get().last_scrape} if start: template_values['start_str'] = start.strftime("%m/%d/%Y") else: template_values['start_str'] = "the beginning of time" if end: template_values['end_str'] = end.strftime("%m/%d/%Y") else: template_values['end_str'] = "the end of time" template = JINJA_ENVIRONMENT.get_template('person_summary.html') self.response.write(template.render(template_values))
def train(person_name, images): if os.path.isdir(images): images = [os.path.join(images, file_name) for file_name in os.listdir(images)] elif os.path.isfile(images): images = [images] for image in images: known_image = face_recognition.load_image_file(image) # known_image = imutils.resize(known_image, width=500) for biden_encoding in face_encodings(known_image): person = Person(person_name, json.dumps((list(biden_encoding)))) session.add(person) session.commit()
def get(self): template_values = {'people': Person.all().run()} template = JINJA_ENVIRONMENT.get_template('index.html') self.response.write(template.render(template_values))