kumar989 commited on
Commit
896d93f
·
1 Parent(s): 46571cd

Upload medbot.py

Browse files
Files changed (1) hide show
  1. medbot.py +187 -0
medbot.py ADDED
@@ -0,0 +1,187 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ import streamlit as st
2
+ import pickle
3
+
4
+ # @st.cache(allow_output_mutation=True)
5
+
6
+ hide_streamlit_style = """
7
+ <style>
8
+ #MainMenu {visibility: hidden;}
9
+ footer {visibility: hidden;}
10
+ </style>
11
+ """
12
+ # st.markdown('<center style="opacity: 70%">OR</center>', unsafe_allow_html=True)
13
+ st.markdown(hide_streamlit_style, unsafe_allow_html=True)
14
+
15
+ st.title('MedicBot')
16
+ w1=0
17
+ w2=0
18
+ w3=0
19
+
20
+ st.markdown('#### Welcome may I know your symptoms:')
21
+ def default():
22
+ global w1,w2,w3
23
+ qq1 = st.selectbox("Feeling dizzy or tierd: ", ('No', 'Yes'))
24
+ q1=0
25
+
26
+ qq2=st.selectbox("Feeling hungry more often than useual: ", ('No', 'Yes'))
27
+ q2=0
28
+
29
+ qq3=st.selectbox("Having a blurryvision recently: ", ('No', 'Yes'))
30
+ q3=0
31
+
32
+ qq4=st.selectbox("Having chest pain",('No', 'Yes'))
33
+ q4=0
34
+
35
+ qq5=st.selectbox("Gender",('Male', 'Female'))
36
+ q5=0
37
+
38
+ qq6=st.selectbox("Asyncronus heart rythm:",('No', 'Yes'))
39
+ q6=0
40
+
41
+ qq7=st.selectbox("Cough?",('No', 'Yes'))
42
+ q7=0
43
+
44
+
45
+ qq8=st.selectbox("Throat soarness?",('No', 'Yes'))
46
+ q8=0
47
+
48
+ qq9=st.selectbox("Loss in smell or taste?",('No', 'Yes'))
49
+ q9=0
50
+ if(st.button('Submit.')):
51
+ if (qq1 == 'Yes'):
52
+ q1=1
53
+ if (qq2=='Yes'):
54
+ q2=1
55
+ if (qq3=='Yes'):
56
+ q3=1
57
+ if (qq4=='Yes'):
58
+ q4=1
59
+ if (qq5=='Female'):
60
+ q5=1
61
+ if (qq6=='Yes'):
62
+ q6=1
63
+ if (qq7=='Yes'):
64
+ q7=1
65
+ if (qq8=='Yes'):
66
+ q8=1
67
+ if (qq9=='Yes'):
68
+ q9=1
69
+ w1=int(q1)+int(q2)+int(q3)
70
+ w2=int(q5)+int(q6)+int(q4)
71
+ w3=int(q7)+int(q8)+int(q9)
72
+ # pred()
73
+
74
+
75
+
76
+ def diaques():
77
+ st.markdown('')
78
+ a1=st.text_input("Enter the no.of pregnencies : ", "")
79
+ b1=st.text_input("Enter the blood glucose level (0-200): ", "")
80
+ c1=st.text_input("Enter the blood pressure (0-125): ", "")
81
+ d1=st.text_input("Enter the skinthickness: (0-110): ", "")
82
+ e1=st.text_input("Enter the insulin levels: (0-750): ", "")
83
+ f1=st.text_input("Enter the BMI (0--): ", "")
84
+ g1=st.text_input("enter age: ", "")
85
+ if(st.button('Submit')):
86
+ a=a1
87
+ b=b1
88
+ c=c1
89
+ d=d1
90
+ e=e1
91
+ f=f1
92
+ g=g1
93
+ return [a,b,c,d,e,f,g]
94
+
95
+ # print(diaques())
96
+
97
+ def coviques():
98
+ a1=st.text_input("Are you having any breathing problems(0 or 1): ", "")
99
+ b1=st.text_input("Are you having any fever (0 or 1): ", "")
100
+ c1=st.text_input("Are you having Dry cough (0 or 1): ", "")
101
+ d1=st.text_input("Having Sore thoart (0 or 1): ", "")
102
+ e1=st.text_input("Having Running Nose (0 or 1): ", "")
103
+ f1=st.text_input("Having Asthma (0 or 1): ", "")
104
+ g1=st.text_input("Having Headache (0 or 1): ", "")
105
+ h1=st.text_input("Having Hyper Tension (0 or 1): ", "")
106
+ i1=st.text_input("Having Fatigue (0 or 1): ", "")
107
+ j1=st.text_input("recently in contact with any covid patient (0 or 1): ", "")
108
+ if(st.button('Submit')):
109
+ a=a1
110
+ b=b1
111
+ c=c1
112
+ d=d1
113
+ e=e1
114
+ f=f1
115
+ g=g1
116
+ h=h1
117
+ i=i1
118
+ j=j1
119
+ return [a,b,c,d,e,f,g,h,i,j]
120
+
121
+ def heartattques():
122
+ a1=st.text_input("Enter age: ", "")
123
+ b1=st.text_input("Enter Gender (0-F & 1-M): ", "")
124
+ c1=st.text_input("Enter chest pain level (0,1,2,3): ", "")
125
+ d1=st.text_input("Enter Resting Blood pressure: ", "")
126
+ e1=st.text_input("nter blood cholestrol( 125-570): ", "")
127
+ f1=st.text_input("Fasting blood sugar if >120mg/dl (0 or 1): ", "")
128
+ g1=st.text_input("Resting ecg (0,1,2): ", "")
129
+ h1=st.text_input("Max heart rate recorded(bpm): ", "")
130
+ i1=st.text_input("is there any exercise induced angina(0 or 1): ", "")
131
+ # j1=st.text_input("recently in contact with any covid patient (0 or 1): ", "")
132
+ if(st.button('Submit')):
133
+ a=a1
134
+ b=b1
135
+ c=c1
136
+ d=d1
137
+ e=e1
138
+ f=f1
139
+ g=g1
140
+ h=h1
141
+ i=i1
142
+ # j=j1
143
+ return [a,b,c,d,e,f,g,h,i]
144
+
145
+ dlt=[]
146
+ def pred():
147
+ global w1,w2,w3
148
+ if max(w1,w2,w3)==w1:
149
+ lt=diaques()
150
+ mo=pickle.load(open(r"C:\Users\kumar\Documents\predproj\diab_pred.sav",'rb'))
151
+ if mo.predict([lt])==1:
152
+ dlt.append('Diabetes')
153
+ elif max(w1,w2,w3)==w2:
154
+ lt=heartattques()
155
+ mo=pickle.load(open(r"C:\Users\kumar\Documents\predproj\heartatt_pred.sav",'rb'))
156
+ if mo.predict([lt])==1:
157
+ dlt.append('Heart attack')
158
+ elif max(w1,w2,w3)==w3:
159
+ lt=coviques()
160
+ mo=pickle.load(open(r"C:\Users\kumar\Documents\predproj\covid_pred.sav",'rb'))
161
+ if mo.predict([lt])==1:
162
+ dlt.append('Covid')
163
+ elif max(w1,w2,w3)==w1 and max(w1,w2,w3)==w2:
164
+ lt=diaques()
165
+ mo=pickle.load(open(r"C:\Users\kumar\Documents\predproj\diab_pred.sav",'rb'))
166
+ if mo.predict([lt])==1:
167
+ dlt.append('Diabetes')
168
+ lt=heartattques()
169
+ mo=pickle.load(open(r"C:\Users\kumar\Documents\predproj\heartatt_pred.sav",'rb'))
170
+ if mo.predict([lt])==1:
171
+ dlt.append('Heart attack')
172
+ elif max(w1,w2,w3)==w1 and max(w1,w2,w3)==w3:
173
+ lt=diaques()
174
+ mo=pickle.load(open(r"C:\Users\kumar\Documents\predproj\diab_pred.sav",'rb'))
175
+ if mo.predict([lt])==1:
176
+ dlt.append('Diabetes')
177
+ lt=coviques()
178
+ mo=pickle.load(open(r"C:\Users\kumar\Documents\predproj\covid_pred.sav",'rb'))
179
+ if mo.predict([lt])==1:
180
+ dlt.append('Covid')
181
+ # default()
182
+
183
+ while True:
184
+ default()
185
+ pred()
186
+ break
187
+ print(dlt)