I have been making a speech recognition and here is my code-
`import speech_recognition as sr
def listen():
r = sr.Recognizer()
with sr.Microphone() as source:
print("Listening...")
r.pause_threshold = 0.9
audio = r.listen(source,0,5)
try:
print("Recognizing...")
query = r.recognize_google(audio,language="en-in")
print(f"You Said : {query}")
except:
return ""
query = str(query)
return query.lower()`
This code works very accurately...but i want to make it faster. More like the speech recognition of google that shows the words as you speak. How do I do it ?
I tried the Watson speech to text of IBM but since its not free i cant apply it for a long term.