def upload(): file = request.files['image'] # Read image image = read_image(file) # Detect faces faces = detect_faces_with_ssd(image) # Draw detection rects num_faces, image = draw_rectangles(image, faces) # Prepare image for html to_send = prepare_image(image) return render_template('index.html', face_detected=len(faces)>0, num_faces=len(faces), image_to_show=to_send, init=True)
def upload(): file = request.files['image'] # Read image image = read_image(file) # Recognize faces classifier_model_path = "models" + os.sep + "lotr_mlp_10c_recognizer.pickle" label_encoder_path = "models" + os.sep + "lotr_mlp_10c_labelencoder.pickle" faces = recognize_faces(image, classifier_model_path, label_encoder_path, detection_api_url=app.config["DETECTION_API_URL"]) # Draw detection rects draw_rectangles(image, faces) # Prepare image for html to_send = prepare_image(image) return render_template('index.html', face_recognized=len(faces)>0, num_faces=len(faces), image_to_show=to_send, init=True)