-
Notifications
You must be signed in to change notification settings - Fork 0
/
main.py
117 lines (48 loc) · 1.5 KB
/
main.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
import pyttsx3
import webbrowser
import wikipedia
import speech_recognition as sr
import datetime
import Response
r= sr.Recognizer()
para = 0
r = sr.Recognizer()
def greeting():
print('Hello Sir How May I Help You ')
Speak('Hello Sir How May I Help You ')
now = int(datetime.datetime.now().hour)
def time_greeting():
if now == 23:
Speak("Sir Its 11pm Working Hard You Should Sleep ")
Speak('May I Help You')
if now == 18 :
Speak('Sir its 6pm')
Speak('May I Help You')
if now == 10:
Speak("GOOD MORNING SIR HAVE A NICE DAY")
Speak('May I Help You')
if now == 13:
Speak ("Sir its Afternoon 1pm")
Speak('May I Help You')
def Speak(command):
too = pyttsx3.init()
too.say(command)
voice = too.getProperty('voices')
too.setProperty('voice',voice[0].id)
too.runAndWait()
while True:
with sr.Microphone() as source2:
print("Getting_Noise......")
r.adjust_for_ambient_noise(source2,duration=1)
print("Listening......")
audio2 = r.listen(source2)
myword = r.recognize_google(audio2)
mw = myword.lower()
print("You : " + mw)
if 'exit' in mw :
Speak('ok logging out')
break
else:
Speak(disko.answers(mw))
print("TOO : " , disko.answers(mw))
## Function List