app.py 文件源码

python
阅读 19 收藏 0 点赞 0 评论 0

项目:who_the_hill 作者: newsdev 项目源码 文件源码
def recongize():
    '''
    Receives POST request from Twilio. Sends data from request to Amazon Rekognize and receives the API's analysis.
    Returns the resulting analysis as JSON.
    '''
    # Reads image data from incoming request
    r = request
    data = r.files['file'].read()

    # Sends image data to Amazon Rekognize for analysis. Returns JSON response of results.
    try:
        results = client.recognize_celebrities(Image={'Bytes': data})
    except botocore.exceptions.ClientError as e:
        results = {"Rekognition Client Error": str(e)}
    logging.info(results)
    return jsonify(results)
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号