I have a audio file which is in Indian English format. When I am running the following code from from local system this code runs perfectly and transcribes successfully but if I run the same piece of code from AWS which is US region it throws the following exception.
I tried to include the language code in recognize_google() but the same issue.
I had looked the 383
speech = r.recognize_google(audio, language = 'pt') File "/Library/Python/2.5/site-packages/speech_recognition/init.py", line 858, in recognize_google if not isinstance(actual_result, dict) or len(actual_result.get("alternative", [])) == 0: raise UnknownValueError() speech_recognition.UnknownValueError
`def recording():
r = sr.Recognizer()
file = sr.AudioFile('qa_full_recording.wav')
with file as source:
r.adjust_for_ambient_noise(source, duration = 0.5) # for removing noise
audio = r.record(source, duration = 150) #remove the 'duration' argument to transcribe complete audio file
txt = r.recognize_google(audio,language="en-IN")
text = repr(txt)
print (text)
return text`
System information
My system is "Ubuntu 16.04 LTS x64" both local and aws
Have you verified the Language (try changing from en-IN to UK based)
, Additionally, why would you try to turn on aws specific machine(EC2) microphone for this task?
Steps to reproduce
I have a audio file which is in Indian English format. When I am running the following code from from local system this code runs perfectly and transcribes successfully but if I run the same piece of code from AWS which is US region it throws the following exception.
I tried to include the language code in recognize_google() but the same issue. I had looked the 383
speech = r.recognize_google(audio, language = 'pt') File "/Library/Python/2.5/site-packages/speech_recognition/init.py", line 858, in recognize_google if not isinstance(actual_result, dict) or len(actual_result.get("alternative", [])) == 0: raise UnknownValueError() speech_recognition.UnknownValueError
`def recording(): r = sr.Recognizer() file = sr.AudioFile('qa_full_recording.wav') with file as source: r.adjust_for_ambient_noise(source, duration = 0.5) # for removing noise
audio = r.record(source, duration = 150) #remove the 'duration' argument to transcribe complete audio file
System information
My system is "Ubuntu 16.04 LTS x64" both local and aws
My Python version is 3.5 both on local and aws
My SpeechRecognition library version is 3.8.1