speech recognition
This commit is contained in:
parent
68ddbc881a
commit
a730fbb2f5
13
py/speech.py
Normal file
13
py/speech.py
Normal file
@ -0,0 +1,13 @@
|
||||
import speech_recognition as sr
|
||||
|
||||
recognizer = sr.Recognizer()
|
||||
with sr.Microphone() as source:
|
||||
print("Speak something...")
|
||||
audio = recognizer.listen(source)
|
||||
try:
|
||||
text = recognizer.recognize_google(audio)
|
||||
print("You said: {}".format(text))
|
||||
except sr.UnknownValueError:
|
||||
print("Could not understand audio.")
|
||||
except sr.RequestError as e:
|
||||
print("Error with API: {}".format(e))
|
||||
Loading…
x
Reference in New Issue
Block a user