自定义模板调用时报服务不可用
yisces_y 发布于2018-04 浏览:1708 回复:2
0
收藏

调用方法:

                String accessToken = instance();
		System.out.println(accessToken);
		//接口地址
		String iocrurl = "https://aip.baidubce.com/rest/2.0/solution/v1/iocr/recognise";
		//自定义模块templateSign 
		String templateSign = "ed7e75975a4205e4c769b873adc30e67";
		//获取图片的base64数据 先获取图片的数组数据再进行base64 编码
		byte[] imgaebinary;
		try {
			imgaebinary = ImageUtil.readImageFile("/text/test.png");
			String imagebase64 = Base64Util.encode(imgaebinary);
			//拼接接口所需参数 image参数需要urlencode哦
			String param = "image="+URLEncoder.encode(imagebase64,"UTF-8")+"&templateSign="+templateSign;
			//开始请求接口
			String result = BaiDuHttpUtil.post(iocrurl, accessToken, param);
			//输出接口返回的内容
			System.out.println(result);
		} catch (Exception e) {
			e.printStackTrace();
		}

返回数据如下展示:

{
    "data":{
        "isStructured":false,
        "logId":"152471158188325"
    },
    "error_code":2,
    "error_msg":"Service temporarily unavailable"
}
收藏
点赞
0
个赞
共2条回复 最后由用户已被禁言回复于2022-04
#3TBS的春天回复于2018-10

+1 这个问题PHP也出现了,还没解决吗

0
#2阿奴波仔回复于2018-04

你好,谢谢反馈。

最近服务不稳定的问题,我们已经观察到,并且已经反馈给技术团队,他们正在全力解决这个问题。

0
TOP
切换版块