예제 #1
0
        public static string GetImageDisposeStr(byte[] data, string token)
        {
            string host   = "https://aip.baidubce.com/rest/2.0/image-classify/v2/advanced_general?access_token=" + token;
            string base64 = ConvertUtility.GetFileBase64(data);
            String str    = "image=" + HttpUtility.UrlEncode(base64);
            BaiduImageRecognitionResult result = NetHelper.HttpPost <BaiduImageRecognitionResult>(host, str);

            if (result.result != null && result.result.Any())
            {
                var bdresult = result.result.OrderByDescending(c => c.score).FirstOrDefault();
                return(bdresult.root + bdresult.keyword);
            }
            else
            {
                return("无法解析此图片");
            }
        }