def get_faces(path):
    with open(path, 'rb') as img:
        bimage = base64.b64encode(img.read())

    Algorithmia.apiKey = 'API_KEY'
    result = Algorithmia.algo('/algo/ANaimi/FaceDetection/0.1.0').pipe(biamge)

    faces = []
    for rect in result:
        face = Face()
        face.name = person_name()
        face.x = rect['x']
        face.y = rect['y']
        face.width = rect['width']
        face.height = rect['height']
        faces.append(face)
        return faces
Exemple #2
0
def get_faces(path):
    with open(settings.MEDIA_ROOT + "/" + path, "rb") as img:
        bimage = base64.b64encode(img.read())
    Algorithmia.apiKey = "Simple simivSeptsC+ZsLks5ia0wXmFbC1"
    result = Algorithmia.algo("/ANaimi/FaceDetection").pipe(bimage)
    faces = []
    for rect in result:
        face = Face()
        face.name = "Petter Rabbit"
        face.x = rect["x"]
        face.y = rect["y"]
        face.width = rect["width"]
        face.height = rect["height"]
        faces.append(face)
        for face in faces:
            face.save()
    return faces
Exemple #3
0
def get_faces(path):
    print "getting faces"
    path = MEDIA_ROOT + "/" + path
    with open(path, 'rb') as img:
        bimage = base64.b64encode(img.read())

    Algorithmia.apiKey = 'Simple totally_real_api_key'
    result = Algorithmia.algo('/ANaimi/FaceDetection').pipe(bimage)

    faces = []
    for rect in result:
        print "found face"
        face = Face()
        face.name = "Anon"
        face.x = rect['x']
        face.y = rect['y']
        face.width = rect['width']
        face.height = rect['height']
        faces.append(face)
        Face.save(face)
    return faces
Exemple #4
0
def get_faces(photo):
    import Algorithmia
    import base64
    Algorithmia.apiKey = os.environ.get('ALGORITHMIA_KEY')

    with default_storage.open(photo.img.name, 'rb') as img:
        b64 = base64.b64encode(img.read())

    rectangles = Algorithmia.algo("/ANaimi/FaceDetection/0.1.2").pipe(b64)

    faces = []
    for rect in rectangles:
        face = Face()
        face.photo = photo
        face.name = '?'
        face.x = rect['x']
        face.y = rect['y']
        face.width = rect['width']
        face.height = rect['height']
        face.save()
        faces.append(face)
    return faces
Exemple #5
0
def get_faces(photo):
    import Algorithmia
    import base64
    Algorithmia.apiKey = "Simple simWy1EsBB4ZucRa4q8DiPocne11"

    with open(photo.image.path, "rb") as img:
        b64 = base64.b64encode(img.read())

    result = Algorithmia.algo("/ANaimi/FaceDetection").pipe(b64)

    faces = []
    for rect in result:
        face = Face()
        face.photo = photo
        face.name = '?'
        face.x = rect['x']
        face.y = rect['y']
        face.width = rect['width']
        face.height = rect['height']
        face.save()
        faces.append(face)

    return faces