当前位置: 首页>>代码示例>>Python>>正文


Python Algorithmia.algo方法代码示例

本文整理汇总了Python中Algorithmia.algo方法的典型用法代码示例。如果您正苦于以下问题:Python Algorithmia.algo方法的具体用法?Python Algorithmia.algo怎么用?Python Algorithmia.algo使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Algorithmia的用法示例。


在下文中一共展示了Algorithmia.algo方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。

示例1: get_faces

# 需要导入模块: import Algorithmia [as 别名]
# 或者: from Algorithmia import algo [as 别名]
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
开发者ID:HeyIamJames,项目名称:django-imager,代码行数:19,代码来源:imagerfacedetector.py

示例2: get_faces

# 需要导入模块: import Algorithmia [as 别名]
# 或者: from Algorithmia import algo [as 别名]
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
开发者ID:tpeek,项目名称:django-imager,代码行数:19,代码来源:views.py

示例3: get_faces

# 需要导入模块: import Algorithmia [as 别名]
# 或者: from Algorithmia import algo [as 别名]
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
开发者ID:doctorMcbob,项目名称:imagersite,代码行数:23,代码来源:facereg.py

示例4: get_faces

# 需要导入模块: import Algorithmia [as 别名]
# 或者: from Algorithmia import algo [as 别名]
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
开发者ID:gatita,项目名称:django-imager,代码行数:24,代码来源:views.py

示例5: get_faces

# 需要导入模块: import Algorithmia [as 别名]
# 或者: from Algorithmia import algo [as 别名]
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
开发者ID:SakiFu,项目名称:django-imager,代码行数:25,代码来源:views.py


注:本文中的Algorithmia.algo方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。