-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathfinal_code.py
More file actions
150 lines (138 loc) · 6.39 KB
/
final_code.py
File metadata and controls
150 lines (138 loc) · 6.39 KB
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
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
import speech_recognition as sr
from gtts import gTTS
import os
def command():
with sr.Microphone() as source:
print("Say Something ")
r=sr.Recognizer()
r.energy_threshold=500
audio=r.listen(source)
try:
print('\n'+r.recognize_google(audio))
except:
pass
word=r.recognize_google(audio)
return word
def assistant(word):
if "who created you" in word :
text_to_speech = gTTS(text='I was Created by The Sam Techtrons', lang='en')
text_to_speech.save('audio.mp3')
os.system('mpg123 audio.mp3')
if "give your introduction" in word:
text_to_speech = gTTS(text='I am Your Health Assistant', lang='en')
text_to_speech.save('audio.mp3')
os.system('mpg123 audio.mp3')
if "what can you do" in word:
text_to_speech = gTTS(text='I can give you some tips for your health and i can also prescribe Medicines for You', lang='en')
text_to_speech.save('audio.mp3')
os.system('mpg123 audio.mp3')
if "I am suffering from fever" in word:
text_to_speech = gTTS(text='You can take paracetamol or asprin..Thank you', lang='en')
text_to_speech.save('audio.mp3')
os.system('mpg123 audio.mp3')
if "I am suffering from headache" in word:
text_to_speech = gTTS(text='You can take disprin..Thank you', lang='en')
text_to_speech.save('audio.mp3')
os.system('mpg123 audio.mp3')
if "I am suffering from cough and cold" in word:
text_to_speech = gTTS(text='You can take amoxicillin..Thank you', lang='en')
text_to_speech.save('audio.mp3')
os.system('mpg123 audio.mp3')
if "I am suffering from diabetes" in word:
text_to_speech = gTTS(text='You can take insulin lispro ..Thank you', lang='en')
text_to_speech.save('audio.mp3')
os.system('mpg123 audio.mp3')
if "I am suffering from stomach ache" in word:
text_to_speech = gTTS(text='You can take panadol..Thank you', lang='en')
text_to_speech.save('audio.mp3')
os.system('mpg123 audio.mp3')
if "I am suffering from skin allergies" in word:
text_to_speech = gTTS(text='You can take allegra..Thank you', lang='en')
text_to_speech.save('audio.mp3')
os.system('mpg123 audio.mp3')
if "I am suffering from vomiting" in word:
text_to_speech = gTTS(text='You can take dolasetron..Thank you', lang='en')
text_to_speech.save('audio.mp3')
os.system('mpg123 audio.mp3')
if "I am suffering from depression" in word:
text_to_speech = gTTS(text='You can take lexapro..Thank you', lang='en')
text_to_speech.save('audio.mp3')
os.system('mpg123 audio.mp3')
if "I am suffering from chicken pox" in word:
text_to_speech = gTTS(text='You can take a cool bath with added baking soda and you can also take benadryl', lang='en')
text_to_speech.save('audio.mp3')
os.system('mpg123 audio.mp3')
if "I am suffering from arthritis" in word:
text_to_speech = gTTS(text='You can take immunosupressive drug and analgesic', lang='en')
text_to_speech.save('audio.mp3')
os.system('mpg123 audio.mp3')
if "I am suffering from asthma" in word:
text_to_speech = gTTS(text='You have to quit smoking and can take anti inflammatory drug', lang='en')
text_to_speech.save('audio.mp3')
os.system('mpg123 audio.mp3')
if "I am suffering from bipolar disorder" in word:
text_to_speech = gTTS(text='You can take antipsychotic drugs ', lang='en')
text_to_speech.save('audio.mp3')
os.system('mpg123 audio.mp3')
if "I am suffering from chest pain" in word:
text_to_speech = gTTS(text='You can take nitroglycerine drugs', lang='en')
text_to_speech.save('audio.mp3')
os.system('mpg123 audio.mp3')
if "I am suffering from conjunctvitis" in word:
text_to_speech = gTTS(text='You can maintain hygeine and self heal with cold compress', lang='en')
text_to_speech.save('audio.mp3')
os.system('mpg123 audio.mp3')
if "I am suffering from constipation" in word:
text_to_speech = gTTS(text='You can take stool softener and fibre supplement', lang='en')
text_to_speech.save('audio.mp3')
os.system('mpg123 audio.mp3')
if "I am suffering from dehydration" in word:
text_to_speech = gTTS(text='You can take oral rehydration solution', lang='en')
text_to_speech.save('audio.mp3')
os.system('mpg123 audio.mp3')
if "I am suffering from food poison" in word:
text_to_speech = gTTS(text='ensure adequate hydration and take rehydration solution', lang='en')
text_to_speech.save('audio.mp3')
os.system('mpg123 audio.mp3')
if "I am suffering from flu" in word:
text_to_speech = gTTS(text='You can take bed rest and antiviral drug ', lang ='en')
text_to_speech.save('audio.mp3')
os.system('mpg123 audio.mp3')
if "I am suffering from indigestion" in word:
text_to_speech = gTTS(text='You can take antacids and oral suspension medicines', lang='en')
text_to_speech.save('audio.mp3')
os.system('mpg123 audio.mp3')
if "I am suffering from insomnia" in word:
text_to_speech = gTTS(text='You can take sedatives and anti depressants', lang='en')
text_to_speech.save('audio.mp3')
os.system('mpg123 audio.mp3')
if "I am suffering from malaria" in word:
text_to_speech = gTTS(text='You can take anti parasites and antibiotics ', lang='en')
text_to_speech.save('audio.mp3')
os.system('mpg123 audio.mp3')
if "I am suffering from malnutrition" in word:
text_to_speech = gTTS(text='You can high protein diet and nutiritive suppliments', lang='en')
text_to_speech.save('audio.mp3')
os.system('mpg123 audio.mp3')
if "I am suffering from obesity" in word:
text_to_speech = gTTS(text='You have to do physical exercise and take low fat diet', lang='en')
text_to_speech.save('audio.mp3')
os.system('mpg123 audio.mp3')
if "I am suffering from panic disorder" in word:
text_to_speech = gTTS(text='You can take anti depressants', lang='en')
text_to_speech.save('audio.mp3')
os.system('mpg123 audio.mp3')
if "I am suffering from scabies" in word:
text_to_speech = gTTS(text='You can take anti parasite drugs', lang='en')
text_to_speech.save('audio.mp3')
os.system('mpg123 audio.mp3')
if "I am suffering from yellow fever" in word:
text_to_speech = gTTS(text='You can take oral rehydration therapy and in critical case consult doctor', lang='en')
text_to_speech.save('audio.mp3')
os.system('mpg123 audio.mp3')
if "I am suffering from acne" in word:
text_to_speech = gTTS(text='You can apply aloe vera and take vitamin a derivatives', lang='en')
text_to_speech.save('audio.mp3')
os.system('mpg123 audio.mp3')
while True:
assistant(command())