using Baidu.Aip.Ocr; using CommonUtil; using System; namespace BaiDuSdk { public class BaiDuClient { private static string APP_ID = "11358195"; private static string API_KEY = "okyelBOfvR8gsHCMKM72gomY"; private static string SECRET_KEY = "1rc3Atc4iRS0sUkFlE6e4GZCAaoAIsfQ"; private static Ocr client = new Ocr(API_KEY, SECRET_KEY); public BaiDuClient() { client.Timeout = 60000; } /// /// 网络图片识别 /// /// public static WebImageUrlResponse WebImageUrl(string imgUrl) { var result = client.WebImageUrl(imgUrl); WebImageUrlResponse response = JSONUtil.JsonToObject(JSONUtil.ObjectToJson(result)); response.IsSuccess = response.error_msg.IsNullOrEmpty() ? true : false; return response; } } }