本文整理汇总了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
示例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
示例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
示例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
示例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