我想使用Amazon rekognition api从图像中获取文本。
这是我的代码:
bucket='my-project'
photo='my-image.jpg'
client=boto3.client('rekognition', 's3-ap-southeast-1')
response=client.detect_text(Image={'S3Object':{'Bucket':bucket,'Name':photo}})
但是,它显示了一个错误:
File "C:\Users\Chan\AppData\Roaming\Python\Python37\site-packages\botocore\client.py", line 661, in _make_api_call
raise error_class(parsed_response, operation_name)
botocore.exceptions.ClientError: An error occurred (412) when calling the DetectText operation:
<?xml version="1.0" encoding="UTF-8"?>
<Error>
<Code>PreconditionFailed</Code>
<Message>At least one of the pre-conditions you specified did not hold</Message>
<Condition>Bucket POST must be of the enclosure-type multipart/form-data</Condition>
<RequestId>BAED284813213F69</RequestId>
<HostId>grt34dS34dgecadsfrrwer424234dxfgKyO1/sdf423sdfshoprtld=</HostId>
</Error>
如何解决问题?