Spaces:
Sleeping
Sleeping
Delete app.py
Browse files
app.py
DELETED
|
@@ -1,105 +0,0 @@
|
|
| 1 |
-
import streamlit as st
|
| 2 |
-
import joblib
|
| 3 |
-
import numpy as np
|
| 4 |
-
## Heading
|
| 5 |
-
html_temp = """
|
| 6 |
-
<div style="background-color:black;padding:10px">
|
| 7 |
-
<h2 style="color:red;text-align:center;">Cardiovascular Health Prediction App </h2>
|
| 8 |
-
</div>
|
| 9 |
-
"""
|
| 10 |
-
st.markdown(html_temp, unsafe_allow_html=True)
|
| 11 |
-
|
| 12 |
-
st.write("Enter the Patient details:")
|
| 13 |
-
|
| 14 |
-
# model
|
| 15 |
-
|
| 16 |
-
health_model=joblib.load("health_model.joblib")
|
| 17 |
-
|
| 18 |
-
scaler_model=joblib.load('scaler_the data_model.joblib')
|
| 19 |
-
|
| 20 |
-
# Input variables
|
| 21 |
-
|
| 22 |
-
col1, col2 = st.columns(2)
|
| 23 |
-
with col1:
|
| 24 |
-
|
| 25 |
-
## Age
|
| 26 |
-
age=st.slider("Slide the AGE of the Patient:",max_value=80,min_value=20)
|
| 27 |
-
|
| 28 |
-
with col2:
|
| 29 |
-
|
| 30 |
-
## gender
|
| 31 |
-
option_gen=["Female "," Male"]
|
| 32 |
-
gen=st.selectbox("Select the Gender",option_gen)
|
| 33 |
-
gender_value=option_gen.index(gen)
|
| 34 |
-
|
| 35 |
-
col1, col2 = st.columns(2)
|
| 36 |
-
with col1:
|
| 37 |
-
## chestpain
|
| 38 |
-
chestpain=st.slider("Slide the chestpain Value:",min_value=0,max_value=3)
|
| 39 |
-
|
| 40 |
-
with col2:
|
| 41 |
-
## restingBP
|
| 42 |
-
restingBP=st.slider("Slide the Resting BP of the Patient:",min_value=90,max_value=200)
|
| 43 |
-
|
| 44 |
-
col1,col2=st.columns(2)
|
| 45 |
-
with col1:
|
| 46 |
-
## serumcholestrol
|
| 47 |
-
serumcholestrol=st.slider("Slide The Serum cholestrol Of a Ptient :",min_value=0,max_value=600)
|
| 48 |
-
|
| 49 |
-
with col2:
|
| 50 |
-
## fastingbloodsugar
|
| 51 |
-
fastingbloodsugar= st.radio("Is Patient blood is Fasting:", ["YES", "NO"])
|
| 52 |
-
if fastingbloodsugar=="YES":
|
| 53 |
-
fastingbloodsugar_value=1
|
| 54 |
-
else:
|
| 55 |
-
fastingbloodsugar_value=0
|
| 56 |
-
|
| 57 |
-
col1,col2=st.columns(2)
|
| 58 |
-
|
| 59 |
-
with col1:
|
| 60 |
-
## restingrelectro
|
| 61 |
-
restingrelectro=st.slider("Slide The restingrelectro of a Patient :",min_value=0,max_value=2)
|
| 62 |
-
|
| 63 |
-
with col2:
|
| 64 |
-
## maxheartrate
|
| 65 |
-
maxheartrate=st.slider("Slide The max heart rate of the Patient :",min_value=70,max_value=200)
|
| 66 |
-
|
| 67 |
-
col1,col2=st.columns(2)
|
| 68 |
-
with col1:
|
| 69 |
-
## exerciseangia
|
| 70 |
-
exerciseangia=st.slider("Slide the exerciseangia Value:",min_value=0,max_value=1)
|
| 71 |
-
|
| 72 |
-
|
| 73 |
-
with col2:
|
| 74 |
-
##oldpeak'
|
| 75 |
-
oldpeak=st.slider("Silde the oldpeak :",max_value=6.2,min_value=0.0,value=0.1)
|
| 76 |
-
|
| 77 |
-
|
| 78 |
-
col1,col2=st.columns(2)
|
| 79 |
-
with col1:
|
| 80 |
-
## slope
|
| 81 |
-
slope=st.slider("Silde the slope of the Patient :",max_value=3,min_value=0,value=1)
|
| 82 |
-
|
| 83 |
-
with col2:
|
| 84 |
-
## noofmajorvessels
|
| 85 |
-
noofmajorvessels=st.slider("Silde the No of Major Vessels to a Patient :",max_value=3,min_value=0,value=1)
|
| 86 |
-
|
| 87 |
-
|
| 88 |
-
if st.button("Submit"):
|
| 89 |
-
|
| 90 |
-
# st.write("before scaleing:",[age,gender_value,chestpain,restingBP,serumcholestrol,fastingbloodsugar_value,restingrelectro,
|
| 91 |
-
# maxheartrate,exerciseangia,oldpeak,slope,noofmajorvessels])
|
| 92 |
-
# Scaler the values
|
| 93 |
-
scaler_val = scaler_model.transform([[age,gender_value,chestpain,restingBP,serumcholestrol,fastingbloodsugar_value,restingrelectro,
|
| 94 |
-
maxheartrate,exerciseangia,oldpeak,slope,noofmajorvessels]])
|
| 95 |
-
|
| 96 |
-
# st.write("after scaleing:",scaler_val)
|
| 97 |
-
|
| 98 |
-
output = health_model.predict(scaler_val)
|
| 99 |
-
|
| 100 |
-
|
| 101 |
-
if output ==0:
|
| 102 |
-
st.write("The patient is Healthy")
|
| 103 |
-
else:
|
| 104 |
-
st.write("The Patient has Heart Disease")
|
| 105 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|