believe itsreal
believe itsreal

Reputation: 13

python speech recognition showing error "module recognition request failed: Internal Server Error"

i was trying to conver voice into text but speech recognisition module throwing internal server error. this is my code:-

import speech_recognition as s 
sr=s.Recognizer()
print("i am your script and listening you...........................")
with s.Microphone() as m:
 audio=sr.listen(m)
 query=sr.recognize_google(audio,language='eng-in')
 print(query)

im getting error like:- `i am your script and listening you........................... Traceback (most recent call last): File "C:\Users\Believe Itsreal\AppData\Local\Programs\Python\Python310\lib\site-packages\speech_recognition_init_.py", line 894, in recognize_google response = urlopen(request, timeout=self.operation_timeout) File "C:\Users\Believe Itsreal\AppData\Local\Programs\Python\Python310\lib\urllib\request.py", line 216, in urlopen return opener.open(url, data, timeout) File "C:\Users\Believe Itsreal\AppData\Local\Programs\Python\Python310\lib\urllib\request.py", line 525, in open response = meth(req, response) File "C:\Users\Believe Itsreal\AppData\Local\Programs\Python\Python310\lib\urllib\request.py", line 634, in http_response response = self.parent.error( File "C:\Users\Believe Itsreal\AppData\Local\Programs\Python\Python310\lib\urllib\request.py", line 563, in error return self._call_chain(*args) File "C:\Users\Believe Itsreal\AppData\Local\Programs\Python\Python310\lib\urllib\request.py", line 496, in _call_chain result = func(*args) File "C:\Users\Believe Itsreal\AppData\Local\Programs\Python\Python310\lib\urllib\request.py", line 643, in http_error_default raise HTTPError(req.full_url, code, msg, hdrs, fp) urllib.error.HTTPError: HTTP Error 500: Internal Server Error

During handling of the above exception, another exception occurred:

Traceback (most recent call last): File "d:\coding\python_in_hole\python code\api.py", line 6, in query=sr.recognize_google(audio,language='eng-in') File "C:\Users\Believe Itsreal\AppData\Local\Programs\Python\Python310\lib\site-packages\speech_recognition_init_.py", line 896, in recognize_google raise RequestError("recognition request failed: {}".format(e.reason)) speech_recognition.RequestError: recognition request failed: Internal Server Error PS D:\coding\python_in_hole> `

i tried to update the module still its not working one of my code on same module was working like a week before but now that code is also not working in this module

Upvotes: 0

Views: 280

Answers (1)

anon
anon

Reputation:

What I suspect is the problem here is that the language parameter being passed to sr.recognize_google is incorrect, and is causing the 500 http response.

According to the documentation for this PyPI module, the language parameter is an RFC5646 language tag, which takes the format en-US or en-AU.

Recommend: using the string en-IN as your language parameter. eng-in is not a valid RFC5646 language tag.

Upvotes: 0

Related Questions