Spaces:
Sleeping
Sleeping
Commit
·
2fdf8ae
1
Parent(s):
71e1275
Upload 5 files
Browse files- app.py +280 -0
- models/diabetes_model.sav +0 -0
- models/heart_disease_model.sav +0 -0
- models/parkinsons_model.sav +0 -0
- requirements.txt +3 -0
app.py
ADDED
@@ -0,0 +1,280 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
import pickle
|
2 |
+
import streamlit as st
|
3 |
+
from streamlit_option_menu import option_menu
|
4 |
+
|
5 |
+
|
6 |
+
# loading the saved models
|
7 |
+
|
8 |
+
diabetes_model = pickle.load(open("./models/diabetes_model.sav", "rb"))
|
9 |
+
|
10 |
+
heart_disease_model = pickle.load(open("./models/heart_disease_model.sav", "rb"))
|
11 |
+
|
12 |
+
parkinsons_model = pickle.load(open("./models/parkinsons_model.sav", "rb"))
|
13 |
+
|
14 |
+
|
15 |
+
# sidebar for navigation
|
16 |
+
with st.sidebar:
|
17 |
+
selected = option_menu(
|
18 |
+
"Multiple Disease Prediction System",
|
19 |
+
["Diabetes Prediction", "Heart Disease Prediction", "Parkinsons Prediction"],
|
20 |
+
icons=["activity", "heart", "person"],
|
21 |
+
default_index=0,
|
22 |
+
)
|
23 |
+
|
24 |
+
|
25 |
+
# Diabetes Prediction Page
|
26 |
+
if selected == "Diabetes Prediction":
|
27 |
+
# page title
|
28 |
+
st.title("Diabetes Prediction using ML")
|
29 |
+
|
30 |
+
# getting the input data from the user
|
31 |
+
col1, col2, col3 = st.columns(3)
|
32 |
+
|
33 |
+
with col1:
|
34 |
+
Pregnancies = st.text_input("Number of Pregnancies")
|
35 |
+
|
36 |
+
with col2:
|
37 |
+
Glucose = st.text_input("Glucose Level")
|
38 |
+
|
39 |
+
with col3:
|
40 |
+
BloodPressure = st.text_input("Blood Pressure value")
|
41 |
+
|
42 |
+
with col1:
|
43 |
+
SkinThickness = st.text_input("Skin Thickness value")
|
44 |
+
|
45 |
+
with col2:
|
46 |
+
Insulin = st.text_input("Insulin Level")
|
47 |
+
|
48 |
+
with col3:
|
49 |
+
BMI = st.text_input("BMI value")
|
50 |
+
|
51 |
+
with col1:
|
52 |
+
DiabetesPedigreeFunction = st.text_input("Diabetes Pedigree Function value")
|
53 |
+
|
54 |
+
with col2:
|
55 |
+
Age = st.text_input("Age of the Person")
|
56 |
+
|
57 |
+
# code for Prediction
|
58 |
+
diab_diagnosis = ""
|
59 |
+
|
60 |
+
# creating a button for Prediction
|
61 |
+
|
62 |
+
if st.button("Diabetes Test Result"):
|
63 |
+
diab_prediction = diabetes_model.predict(
|
64 |
+
[
|
65 |
+
[
|
66 |
+
Pregnancies,
|
67 |
+
Glucose,
|
68 |
+
BloodPressure,
|
69 |
+
SkinThickness,
|
70 |
+
Insulin,
|
71 |
+
BMI,
|
72 |
+
DiabetesPedigreeFunction,
|
73 |
+
Age,
|
74 |
+
]
|
75 |
+
]
|
76 |
+
)
|
77 |
+
|
78 |
+
if diab_prediction[0] == 1:
|
79 |
+
diab_diagnosis = "The person is diabetic"
|
80 |
+
else:
|
81 |
+
diab_diagnosis = "The person is not diabetic"
|
82 |
+
|
83 |
+
st.success(diab_diagnosis)
|
84 |
+
|
85 |
+
|
86 |
+
# Heart Disease Prediction Page
|
87 |
+
if selected == "Heart Disease Prediction":
|
88 |
+
# page title
|
89 |
+
st.title("Heart Disease Prediction using ML")
|
90 |
+
|
91 |
+
col1, col2, col3 = st.columns(3)
|
92 |
+
|
93 |
+
with col1:
|
94 |
+
age = st.text_input("Age")
|
95 |
+
|
96 |
+
with col2:
|
97 |
+
sex = st.text_input("Sex")
|
98 |
+
|
99 |
+
with col3:
|
100 |
+
cp = st.text_input("Chest Pain types")
|
101 |
+
|
102 |
+
with col1:
|
103 |
+
trestbps = st.text_input("Resting Blood Pressure")
|
104 |
+
|
105 |
+
with col2:
|
106 |
+
chol = st.text_input("Serum Cholestoral in mg/dl")
|
107 |
+
|
108 |
+
with col3:
|
109 |
+
fbs = st.text_input("Fasting Blood Sugar > 120 mg/dl")
|
110 |
+
|
111 |
+
with col1:
|
112 |
+
restecg = st.text_input("Resting Electrocardiographic results")
|
113 |
+
|
114 |
+
with col2:
|
115 |
+
thalach = st.text_input("Maximum Heart Rate achieved")
|
116 |
+
|
117 |
+
with col3:
|
118 |
+
exang = st.text_input("Exercise Induced Angina")
|
119 |
+
|
120 |
+
with col1:
|
121 |
+
oldpeak = st.text_input("ST depression induced by exercise")
|
122 |
+
|
123 |
+
with col2:
|
124 |
+
slope = st.text_input("Slope of the peak exercise ST segment")
|
125 |
+
|
126 |
+
with col3:
|
127 |
+
ca = st.text_input("Major vessels colored by flourosopy")
|
128 |
+
|
129 |
+
with col1:
|
130 |
+
thal = st.text_input(
|
131 |
+
"thal: 0 = normal; 1 = fixed defect; 2 = reversable defect"
|
132 |
+
)
|
133 |
+
|
134 |
+
# code for Prediction
|
135 |
+
heart_diagnosis = ""
|
136 |
+
|
137 |
+
# creating a button for Prediction
|
138 |
+
|
139 |
+
if st.button("Heart Disease Test Result"):
|
140 |
+
heart_prediction = heart_disease_model.predict(
|
141 |
+
[
|
142 |
+
[
|
143 |
+
age,
|
144 |
+
sex,
|
145 |
+
cp,
|
146 |
+
trestbps,
|
147 |
+
chol,
|
148 |
+
fbs,
|
149 |
+
restecg,
|
150 |
+
thalach,
|
151 |
+
exang,
|
152 |
+
oldpeak,
|
153 |
+
slope,
|
154 |
+
ca,
|
155 |
+
thal,
|
156 |
+
]
|
157 |
+
]
|
158 |
+
)
|
159 |
+
|
160 |
+
if heart_prediction[0] == 1:
|
161 |
+
heart_diagnosis = "The person is having heart disease"
|
162 |
+
else:
|
163 |
+
heart_diagnosis = "The person does not have any heart disease"
|
164 |
+
|
165 |
+
st.success(heart_diagnosis)
|
166 |
+
|
167 |
+
|
168 |
+
# Parkinson's Prediction Page
|
169 |
+
if selected == "Parkinsons Prediction":
|
170 |
+
# page title
|
171 |
+
st.title("Parkinson's Disease Prediction using ML")
|
172 |
+
|
173 |
+
col1, col2, col3, col4, col5 = st.columns(5)
|
174 |
+
|
175 |
+
with col1:
|
176 |
+
fo = st.text_input("MDVP:Fo(Hz)")
|
177 |
+
|
178 |
+
with col2:
|
179 |
+
fhi = st.text_input("MDVP:Fhi(Hz)")
|
180 |
+
|
181 |
+
with col3:
|
182 |
+
flo = st.text_input("MDVP:Flo(Hz)")
|
183 |
+
|
184 |
+
with col4:
|
185 |
+
Jitter_percent = st.text_input("MDVP:Jitter(%)")
|
186 |
+
|
187 |
+
with col5:
|
188 |
+
Jitter_Abs = st.text_input("MDVP:Jitter(Abs)")
|
189 |
+
|
190 |
+
with col1:
|
191 |
+
RAP = st.text_input("MDVP:RAP")
|
192 |
+
|
193 |
+
with col2:
|
194 |
+
PPQ = st.text_input("MDVP:PPQ")
|
195 |
+
|
196 |
+
with col3:
|
197 |
+
DDP = st.text_input("Jitter:DDP")
|
198 |
+
|
199 |
+
with col4:
|
200 |
+
Shimmer = st.text_input("MDVP:Shimmer")
|
201 |
+
|
202 |
+
with col5:
|
203 |
+
Shimmer_dB = st.text_input("MDVP:Shimmer(dB)")
|
204 |
+
|
205 |
+
with col1:
|
206 |
+
APQ3 = st.text_input("Shimmer:APQ3")
|
207 |
+
|
208 |
+
with col2:
|
209 |
+
APQ5 = st.text_input("Shimmer:APQ5")
|
210 |
+
|
211 |
+
with col3:
|
212 |
+
APQ = st.text_input("MDVP:APQ")
|
213 |
+
|
214 |
+
with col4:
|
215 |
+
DDA = st.text_input("Shimmer:DDA")
|
216 |
+
|
217 |
+
with col5:
|
218 |
+
NHR = st.text_input("NHR")
|
219 |
+
|
220 |
+
with col1:
|
221 |
+
HNR = st.text_input("HNR")
|
222 |
+
|
223 |
+
with col2:
|
224 |
+
RPDE = st.text_input("RPDE")
|
225 |
+
|
226 |
+
with col3:
|
227 |
+
DFA = st.text_input("DFA")
|
228 |
+
|
229 |
+
with col4:
|
230 |
+
spread1 = st.text_input("spread1")
|
231 |
+
|
232 |
+
with col5:
|
233 |
+
spread2 = st.text_input("spread2")
|
234 |
+
|
235 |
+
with col1:
|
236 |
+
D2 = st.text_input("D2")
|
237 |
+
|
238 |
+
with col2:
|
239 |
+
PPE = st.text_input("PPE")
|
240 |
+
|
241 |
+
# code for Prediction
|
242 |
+
parkinsons_diagnosis = ""
|
243 |
+
|
244 |
+
# creating a button for Prediction
|
245 |
+
if st.button("Parkinson's Test Result"):
|
246 |
+
parkinsons_prediction = parkinsons_model.predict(
|
247 |
+
[
|
248 |
+
[
|
249 |
+
fo,
|
250 |
+
fhi,
|
251 |
+
flo,
|
252 |
+
Jitter_percent,
|
253 |
+
Jitter_Abs,
|
254 |
+
RAP,
|
255 |
+
PPQ,
|
256 |
+
DDP,
|
257 |
+
Shimmer,
|
258 |
+
Shimmer_dB,
|
259 |
+
APQ3,
|
260 |
+
APQ5,
|
261 |
+
APQ,
|
262 |
+
DDA,
|
263 |
+
NHR,
|
264 |
+
HNR,
|
265 |
+
RPDE,
|
266 |
+
DFA,
|
267 |
+
spread1,
|
268 |
+
spread2,
|
269 |
+
D2,
|
270 |
+
PPE,
|
271 |
+
]
|
272 |
+
]
|
273 |
+
)
|
274 |
+
|
275 |
+
if parkinsons_prediction[0] == 1:
|
276 |
+
parkinsons_diagnosis = "The person has Parkinson's disease"
|
277 |
+
else:
|
278 |
+
parkinsons_diagnosis = "The person does not have Parkinson's disease"
|
279 |
+
|
280 |
+
st.success(parkinsons_diagnosis)
|
models/diabetes_model.sav
ADDED
Binary file (27.9 kB). View file
|
|
models/heart_disease_model.sav
ADDED
Binary file (1.21 kB). View file
|
|
models/parkinsons_model.sav
ADDED
Binary file (12.7 kB). View file
|
|
requirements.txt
ADDED
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
1 |
+
streamlit
|
2 |
+
streamlit_option_menu
|
3 |
+
scikit-learn==1.0.2
|