Google云视觉 - 从OCR请求中获取JSON错误响应

时间:2022-02-16 20:18:54

I'm new at using google cloud API so please forgive me if I ask any silly question. I want to try develop android app by Xamarin c# to do OCR for Thai language, so my idea is to and I want to get OCR result from my photo. This's my json request

我是使用谷歌云API的新手,所以如果我问任何愚蠢的问题,请原谅我。我想尝试用Xamarin c#开发Android应用来为泰语做OCR,所以我的想法是,我想从我的照片中得到OCR结果。这是我的json请求

{"requests": [
{"image":{"content":"3QGzdykwB2MZPcpx...."},
"imageContext": {"languageHints":["th"]},
"features": [{"type":"DOCUMENT_TEXT_DETECTION"}]}]}

But the result that I got is

但我得到的结果是

"error": {
"code": 14,
"message": "Service temporarily unavailable. Error processing features."}

What wrong with this? Anyone please give some suggestion. Thank you.

这有什么问题?任何人请提出一些建议。谢谢。

1 个解决方案

#1


0  

Since you have not provided the source code,let me assume that you are using the GoogleCloudPlatform/java-docs-samples

由于您尚未提供源代码,因此我假设您使用的是GoogleCloudPlatform / java-docs-samples

The main reason for the above exception is that the face annotations in the below code is null. You can just update the following code as your requirement

上述异常的主要原因是下面代码中的面注释为null。您可以根据需要更新以下代码

if (response.getFaceAnnotations() == null) {
  throw new IOException(
      response.getError() != null
          ? response.getError().getMessage()
          : "Unknown error getting image annotations");
}

#1


0  

Since you have not provided the source code,let me assume that you are using the GoogleCloudPlatform/java-docs-samples

由于您尚未提供源代码,因此我假设您使用的是GoogleCloudPlatform / java-docs-samples

The main reason for the above exception is that the face annotations in the below code is null. You can just update the following code as your requirement

上述异常的主要原因是下面代码中的面注释为null。您可以根据需要更新以下代码

if (response.getFaceAnnotations() == null) {
  throw new IOException(
      response.getError() != null
          ? response.getError().getMessage()
          : "Unknown error getting image annotations");
}