File size: 438 Bytes
af63393 |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 |
import speech_recognition as sr
def capture_input():
r = sr.Recognizer()
with sr.Microphone() as source:
print("Belel is listening...")
audio = r.listen(source)
try:
return r.recognize_google(audio)
except sr.UnknownValueError:
return "Sorry, I didn't catch that."
except sr.RequestError:
return "Error: Could not reach the speech recognition service."
|