kumar989 commited on
Commit
8a24d03
·
1 Parent(s): 8acd289

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +10 -114
app.py CHANGED
@@ -16,7 +16,7 @@ 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
@@ -70,118 +70,14 @@ def default():
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)
 
16
  w1=0
17
  w2=0
18
  w3=0
19
+ lt=[]
20
  st.markdown('#### Welcome may I know your symptoms:')
21
  def default():
22
  global w1,w2,w3
 
70
  w2=int(q5)+int(q6)+int(q4)
71
  w3=int(q7)+int(q8)+int(q9)
72
  # pred()
73
+ lt.append(q1,q2,q3,q4,q5,q6,q7,q8,q9)
74
 
75
 
76
+ default()
77
+ if sum(lt)>=len(lt)//2:
78
+ st.write('')
79
+ st.write('It\'s better if reach out to Physician')
80
+ else:
81
+ st.write('')
82
+ st.write('You may take some self care and reachout to a doctor if you feel so.')
83
+