简体   繁体   English

Google Cloud Vision API PDF 文本提取

[英]Google Cloud Vision API PDF text extraction

I'm trying to extract text from a pdf(image converted to pdf) using python code provided in google docs https://cloud.google.com/vision/docs/pdf .我正在尝试使用 google 文档https://cloud.google.com/vision/docs/pdf中提供的 python 代码从 pdf(图像转换为 pdf)中提取文本。 I have created service account key and using it for authentication as mentioned in docs and I'm using google SDK in my PC.我已经创建了服务帐户密钥并将其用于文档中提到的身份验证,并且我在我的 PC 中使用了谷歌 SDK。 The code is getting timed out with the below error:代码因以下错误而超时:

File "C:\*****\pdf_code.py", line 39, in async_detect_document
operation.result(timeout=180)   File "C:\Python27\lib\site-packages\google\api_core\future\polling.py", line 120, in result
raise self._exception google.api_core.exceptions.GoogleAPICallError: None Error writing final output to: gs://******/output-1-to-1.json

Any help would be appreciated.任何帮助,将不胜感激。

i was getting a similar error, i was using a service account to access cloud vision api and using the service account key on my local我遇到了类似的错误,我正在使用服务帐户访问云视觉 API 并在本地使用服务帐户密钥

i solved the above error by giving the same service account permissions to write on the bucket ->我通过授予相同的服务帐户写入存储桶的权限解决了上述错误 - >

  • navigate to console.cloud.google.com导航到 console.cloud.google.com
  • storage->browser --> navigate to the bucket you want to store the output files in storage->browser --> 导航到要存储输出文件的存储桶
  • select the permissions tab --> click on "add members" button选择权限选项卡 --> 单击“添加成员”按钮
  • mention your service account in the "new members" text box -- something like "xyz-vision-api@your_project_name.iam.gserviceaccount.com"在“新成员”文本框中提及您的服务帐户——类似于“xyz-vision-api@your_project_name.iam.gserviceaccount.com”
  • select the storage-admin role选择存储管理员角色
  • save救球

your error should be resolved你的错误应该得到解决

it reads: Error writing final output to: gs://******/output-1-to-1.json它显示: Error writing final output to: gs://******/output-1-to-1.json

... you may have to install gcloud and gsutil locally; ...您可能必须在本地安装gcloudgsutil also check bucket ACL .还要检查存储桶ACL

while gcloud is not logged in or gsutil isn't available, this will not write to bucket.gcloud未登录或gsutil不可用时,这不会写入存储桶。

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 OCR PDF 文件使用 Google Cloud Vision? - OCR PDF Files Using Google Cloud Vision? Google Cloud Vision API - DOCUMENT_TEXT_DETECTION:“页面”中没有“属性”字段 - Google Cloud Vision API - DOCUMENT_TEXT_DETECTION: no "property" field in "pages" Google Cloud Vision 安全搜索 API 未返回预期结果 - Google Cloud Vision Safe search API not returning expected results 节点JS | 谷歌视觉 API | 将 base64 发送到 Google Cloud Vision 时出现“错误的图像数据” - Node JS | Google Vision API | "Bad image data" when sending base64 to Google Cloud Vision Google Cloud Vision API 是否检测 OCRed 文本中的格式,如粗体、斜体、字体名称(helvetica 或 times new roman)等? - Does Google Cloud Vision API detect formatting in OCRed text like bold, italics, font name (helvetica or times new roman), etc? Google Cloud Vision API 将所有图像检测为不当 - Google Cloud Vision API detects all images as inappropriate 使用 python 在 Google Cloud Vision 中逐行检测文本 - Line by Line Text Detection in Google Cloud Vision using python 是否可以在 Xamarin 中使用 Google Cloud Vision Nuget 突出显示检测到的文本? - Is it possible to highlight detected text using the Google Cloud Vision Nuget in Xamarin? 谷歌云愿景与谷歌存储 - Google cloud vision with Google storage Google Vision API 通过浏览器调用存储在 Firestore 中的文件进行文档文本检测 - Google Vision API call via Browser for Document Text Detection from File stored in Firestore
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM