繁体   English   中英

终端上使用Python的云异步语音识别错误

[英]Cloud Asynchronous Speech Recognition Error with Python on terminal

我在这个问题上花了大约3天的时间。 本质上,我正在尝试使用Google Cloud Speech 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和vitual 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,目前是我的第一年,所以这可能是一个初学者的错误,但是非常感谢您的帮助,因为我为此付出了一段时间!

PS当前我的文件是公开的,因此如果可以直接尝试它,该文件仍然可用。

谢谢。

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

response = operation.result(timeout=1000)

看看是否有帮助。

您可能考虑使用Google Cloud SDK ,目前在Beta中有一个用于此目的的命令

gcloud beta ml speech recognize gs://architecture-transcript-1/architecture.flac \
  --sample-rate 44100 --language en-US --encoding=FLAC

暂无
暂无

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

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM