Spaces:
Sleeping
Sleeping
update app.py
Browse files
app.py
CHANGED
@@ -1,65 +1,65 @@
|
|
1 |
-
import pickle
|
2 |
-
import streamlit as st
|
3 |
-
from streamlit_option_menu import option_menu
|
4 |
-
|
5 |
-
#loading the saved data
|
6 |
-
|
7 |
-
heart_disease_model = pickle.load(open("
|
8 |
-
|
9 |
-
st.title('Heart Disease Prediction using ML')
|
10 |
-
|
11 |
-
col1, col2, col3 = st.columns(3)
|
12 |
-
|
13 |
-
with col1:
|
14 |
-
age = st.text_input('Age')
|
15 |
-
|
16 |
-
with col2:
|
17 |
-
sex = st.text_input('Sex')
|
18 |
-
|
19 |
-
with col3:
|
20 |
-
cp = st.text_input('Chest Pain types')
|
21 |
-
|
22 |
-
with col1:
|
23 |
-
trestbps = st.text_input('Resting Blood Pressure')
|
24 |
-
|
25 |
-
with col2:
|
26 |
-
chol = st.text_input('Serum Cholestoral in mg/dl')
|
27 |
-
|
28 |
-
with col3:
|
29 |
-
fbs = st.text_input('Fasting Blood Sugar > 120 mg/dl')
|
30 |
-
|
31 |
-
with col1:
|
32 |
-
restecg = st.text_input('Resting Electrocardiographic results')
|
33 |
-
|
34 |
-
with col2:
|
35 |
-
thalach = st.text_input('Maximum Heart Rate achieved')
|
36 |
-
|
37 |
-
with col3:
|
38 |
-
exang = st.text_input('Exercise Induced Angina')
|
39 |
-
|
40 |
-
with col1:
|
41 |
-
oldpeak = st.text_input('ST depression induced by exercise')
|
42 |
-
|
43 |
-
with col2:
|
44 |
-
slope = st.text_input('Slope of the peak exercise ST segment')
|
45 |
-
|
46 |
-
with col3:
|
47 |
-
ca = st.text_input('Major vessels colored by flourosopy')
|
48 |
-
|
49 |
-
with col1:
|
50 |
-
thal = st.text_input('thal: 0 = normal; 1 = fixed defect; 2 = reversable defect')
|
51 |
-
|
52 |
-
# code for Prediction
|
53 |
-
heart_diagnosis = ''
|
54 |
-
|
55 |
-
# creating a button for Prediction
|
56 |
-
|
57 |
-
if st.button('Heart Disease Test Result'):
|
58 |
-
heart_prediction = heart_disease_model.predict([[
|
59 |
-
'age', 'sex',' cp', 'trestbps', 'chol', 'fbs', 'restecg', 'thalach', 'exang', 'oldpeak', 'slope', 'ca', 'thal']])
|
60 |
-
if (heart_prediction[0] == 1):
|
61 |
-
heart_diagnosis = 'The person is having heart disease'
|
62 |
-
else:
|
63 |
-
heart_diagnosis = 'The person does not have any heart disease'
|
64 |
-
|
65 |
-
st.success(heart_diagnosis)
|
|
|
1 |
+
import pickle
|
2 |
+
import streamlit as st
|
3 |
+
from streamlit_option_menu import option_menu
|
4 |
+
|
5 |
+
#loading the saved data
|
6 |
+
|
7 |
+
heart_disease_model = pickle.load(open("heart_disease_model.sav",'rb'))
|
8 |
+
|
9 |
+
st.title('Heart Disease Prediction using ML')
|
10 |
+
|
11 |
+
col1, col2, col3 = st.columns(3)
|
12 |
+
|
13 |
+
with col1:
|
14 |
+
age = st.text_input('Age')
|
15 |
+
|
16 |
+
with col2:
|
17 |
+
sex = st.text_input('Sex')
|
18 |
+
|
19 |
+
with col3:
|
20 |
+
cp = st.text_input('Chest Pain types')
|
21 |
+
|
22 |
+
with col1:
|
23 |
+
trestbps = st.text_input('Resting Blood Pressure')
|
24 |
+
|
25 |
+
with col2:
|
26 |
+
chol = st.text_input('Serum Cholestoral in mg/dl')
|
27 |
+
|
28 |
+
with col3:
|
29 |
+
fbs = st.text_input('Fasting Blood Sugar > 120 mg/dl')
|
30 |
+
|
31 |
+
with col1:
|
32 |
+
restecg = st.text_input('Resting Electrocardiographic results')
|
33 |
+
|
34 |
+
with col2:
|
35 |
+
thalach = st.text_input('Maximum Heart Rate achieved')
|
36 |
+
|
37 |
+
with col3:
|
38 |
+
exang = st.text_input('Exercise Induced Angina')
|
39 |
+
|
40 |
+
with col1:
|
41 |
+
oldpeak = st.text_input('ST depression induced by exercise')
|
42 |
+
|
43 |
+
with col2:
|
44 |
+
slope = st.text_input('Slope of the peak exercise ST segment')
|
45 |
+
|
46 |
+
with col3:
|
47 |
+
ca = st.text_input('Major vessels colored by flourosopy')
|
48 |
+
|
49 |
+
with col1:
|
50 |
+
thal = st.text_input('thal: 0 = normal; 1 = fixed defect; 2 = reversable defect')
|
51 |
+
|
52 |
+
# code for Prediction
|
53 |
+
heart_diagnosis = ''
|
54 |
+
|
55 |
+
# creating a button for Prediction
|
56 |
+
|
57 |
+
if st.button('Heart Disease Test Result'):
|
58 |
+
heart_prediction = heart_disease_model.predict([[
|
59 |
+
'age', 'sex',' cp', 'trestbps', 'chol', 'fbs', 'restecg', 'thalach', 'exang', 'oldpeak', 'slope', 'ca', 'thal']])
|
60 |
+
if (heart_prediction[0] == 1):
|
61 |
+
heart_diagnosis = 'The person is having heart disease'
|
62 |
+
else:
|
63 |
+
heart_diagnosis = 'The person does not have any heart disease'
|
64 |
+
|
65 |
+
st.success(heart_diagnosis)
|