### get access token
api_key = '***************'
secret_key = '***************'
host = "https://aip.baidubce.com/oauth/2.0/token?grant_type=client_credentials&client_id=#{api_key}&client_secret=#{secret_key}"
response = Net::HTTP.get(URI(host))
access_token = JSON.parse(response)["access_token"]
### 识别图片
access_token = "***************"
uri = URI('https://aip.baidubce.com/rest/2.0/ocr/v1/general_basic?access_token='+access_token)
params = {"image" => image_base64 }
res = Net::HTTP.post_form(uri, params)
puts res.body
收藏
点赞
0
个赞
请登录后评论
TOP
切换版块
什么问题