簡體   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