Python 如何在AmazonS3中的集合中添加项目?
我有以下创建数据收集的代码:Python 如何在AmazonS3中的集合中添加项目?,python,amazon-web-services,amazon-s3,amazon,boto3,Python,Amazon Web Services,Amazon S3,Amazon,Boto3,我有以下创建数据收集的代码: import boto3 def createCollection(): cliente = boto3.client('rekognition') respuesta = cliente.create_collection (CollectionId = 'Fotos') print (respuesta) createCollection() 但我的问题是如何在此集合中添加项目。 你能帮帮我吗。 谢谢。假设您
import boto3
def createCollection():
cliente = boto3.client('rekognition')
respuesta = cliente.create_collection (CollectionId = 'Fotos')
print (respuesta)
createCollection()
但我的问题是如何在此集合中添加项目。
你能帮帮我吗。
谢谢。假设您正在尝试从本地文件系统向集合添加映像,您可以使用以下方法:
没问题!如果你对答案感到满意,别忘了接受它
with open('image.png', 'rb') as image:
respuesta = cliente.index_faces(Image={'Bytes': image.read()}, CollectionId='Fotos')
print respuesta