美文网首页
百度AI中图像审核的调用

百度AI中图像审核的调用

作者: Shen小妹 | 来源:发表于2020-07-18 00:48 被阅读0次

(1)首先需要通过API Key和Secret Key获取access_token

调用:

import requests

import base64

'''

相似图检索—入库

'''

request_url = "https://aip.baidubce.com/rest/2.0/solution/v1/img_censor/v2/user_defined"

f = open('1.jpg', 'rb')

img = base64.b64encode(f.read())

params = params

access_token = '24.0becef4766a702132426a128bcc54ed9.2592000.1597595660.282335-21446950'

image = 1

request_url = request_url + "?access_token=" + access_token

headers = {'content-type': 'application/x-www-form-urlencoded'}

response = requests.post(request_url, data=params, headers=headers)

if response:

    print (response.json())

输出:

{'conclusion': '合规', 'log_id': 15950043563395027, 'conclusionType': 1}

相关文章

网友评论

      本文标题:百度AI中图像审核的调用

      本文链接:https://www.haomeiwen.com/subject/bknohktx.html