-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathapp.py
More file actions
24 lines (19 loc) · 712 Bytes
/
app.py
File metadata and controls
24 lines (19 loc) · 712 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
import speech_recognition as sr
import webbrowser as web
path="C:/Program Files/Google/Chrome/Application/chrome.exe %s"
r = sr.Recognizer()
with sr.Microphone() as source:
print("Say something!")
r.adjust_for_ambient_noise(source,duration=0.5)
audio = r.listen(source)
try:
madhurvachan = r.recognize_google(audio)
#print(r.recognize_google(audio, show_all=True))
print(madhurvachan)
web.get(path).open(madhurvachan)
except sr.UnknownValueError:
print("Google Speech Recognition could not understand audio")
except sr.RequestError as e:
print("Could not request results from Google Speech Recognition service; {0}".format(e))
if __name__ == '__main__':
app.run()