gpt4 book ai didi

python - 终端上Python的云异步语音识别错误

转载 作者:行者123 更新时间:2023-12-01 02:29:39 25 4
gpt4 key购买 nike

我花了大约 3 天的时间来解决这个同样的问题。本质上,我正在尝试使用谷歌云语音 api 对我的音频文件进行粗略转录,该文件位于 gs://architecture-transcript-1/architecture.flac该文件以前是m4a,但我将其转换为flac文件,它的采样率为44100hz,持续1小时18分钟。

我正在运行 Python 3.5 并使用命令提示符。我一直在使用的教程可以在这里找到:https://github.com/GoogleCloudPlatform/python-docs-samples/blob/master/speech/cloud-client/README.rst

我已经完成了教程中的所有步骤,其中包括安装 pip 和 virual env、安装依赖项,然后简单地使用创建的命令“transcribe_async.py”。

在命令提示符中,如下所示:

:\> virtualenv env
:\> virtualenv env/bin/activate
:\> cd C:\python-docs-samples-master\speech\cloud-client
C:\python-docs-samples-master\speech\cloud-client> pip install -r requirements.txt
C:\python-docs-samples-master\speech\cloud-client> python transcribe_async.py gs://architecture-transcript-1/architecture.flac

在此之前,我进入 transcribe_async.py 文件以确保我的编码和文件格式匹配。
运行后,它说等待操作完成...然后得到这个最终错误:

File "transcribe_async.py", line 96, in <module>
transcribe_gcs(args.path)
File "transcribe_async.py", line 79, in transcribe_gcs
response = operation.result(timeout=90)
File "C:\Users\George\Anaconda3\lib\site-packages\google\gax\__init__.py",
line 595, in result
if not self._poll(timeout).HasField('response'):
File "C:\Users\George\Anaconda3\lib\site-packages\google\gax\__init__.py",
line 705, in _poll
return retryable_done_check()
File "C:\Users\George\Anaconda3\lib\site-packages\google\gax\retry.py", line
143, in inner
raise exc
google.gax.errors.RetryError: RetryError(Retry total timeout exceeded with
exception, caused by Deadline Exceeded)

主要错误似乎是:“google.gax.errors.RetryError:RetryError(重试总超时超出异常,由超出截止日期引起)”

我在使用 google python 代码尝试我的音频文件时得到了这个。

我正在学习如何使用 Python,目前是我的第一年,所以这可能是一个初学者的错误,但我们将非常感谢您的帮助,因为我已经为此苦苦挣扎了一段时间!

P.S 目前我的文件是公开的,因此如果直接尝试有帮助,它仍然可用。

谢谢。

最佳答案

我不知道您用于转录的音频文件的持续时间。我建议您暂时在“transcribe_async.py”中的第 79 行使用较大的数字

response = operation.result(timeout=1000)

看看是否有帮助。

关于python - 终端上Python的云异步语音识别错误,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/46984911/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com