GCP 函数缺少属性,将 PDF 转换为 MP3

GCP Function Missing Attribute, Converting PDFs to MP3s

我正在尝试复制这个 GCP 项目,其中几个开发人员创建了一个 GCP 函数,可以对 PDF 执行光学字符识别,提取文本,然后将文本转换为 MP3。 Link to the video for that project can be seen here.

我从事辅助功能方面的工作,因此这对我的用户来说将是一个令人难以置信的解决方案,但我 运行 遇到了几个问题。

我为 PDF 创建了存储桶,然后去创建函数,and used the code from one of the developer's github, linked here.

但是,我 运行 在尝试部署函数时遇到此错误:

Function failed on loading user code. Error message: File main.py is expected to contain a function named hello_gcs
Detailed stack trace:
Traceback (most recent call last):
File "/env/local/lib/python3.7/site-packages/google/cloud/functions/worker_v1.py", line 315, in check_or_load_user_function
_function_handler.load_user_function()
File "/env/local/lib/python3.7/site-packages/google/cloud/functions/worker_v1.py", line 193, in load_user_function
self._user_function = getattr(main_module, _ENTRY_POINT)
AttributeError: module 'main' has no attribute 'hello_gcs'

这可能是一个非常简单的修复,但我并没有那么多地使用 GCP 函数。任何解决此问题的建议将不胜感激。谢谢!

我想我明白了!当我第一次创建函数时有一段原始代码,我在粘贴开发人员代码时将其删除。我将原始代码段粘贴回去,现在它部署得很好!现在看看我是否能弄清楚项目的其余部分哈哈。