首页 > 其他 > 详细

百度ai图像识别

时间:2019-08-18 13:34:21      阅读:102      评论:0      收藏:0      [点我收藏+]

require ‘restclient‘
require ‘open-uri‘
require ‘nokogiri‘
require ‘json‘
require ‘yaml‘
require ‘fileutils‘
require ‘base64‘


def
extract_phone(image_src) url = "https://aip.baidubce.com/rest/2.0/ocr/v1/general_basic" access_token = "24.0bbbc3338fcf9df41f26b42ff2a077.2593200.15323228.282335-11449805" content_type = "application/x-www-form-urlencoded" file = open(image_src).read image = Base64.encode64(file) RestClient.post(url, {access_token: access_token, image: image}, {content_type: content_type}) do |response| body = JSON.parse(response.body) return raise unless body[error_code].nil? return body["words_result"][0]["words"] end end

 

百度ai图像识别

原文:https://www.cnblogs.com/znsongshu/p/11371814.html

(0)
(0)
   
举报
评论 一句话评论(0
关于我们 - 联系我们 - 留言反馈 - 联系我们:wmxa8@hotmail.com
© 2014 bubuko.com 版权所有
打开技术之扣,分享程序人生!