|
|
import streamlit as st
|
|
|
import joblib
|
|
|
import numpy as np
|
|
|
|
|
|
html_temp = """
|
|
|
<div style="background-color:black;padding:10px">
|
|
|
<h2 style="color:red;text-align:center;">Cardiovascular Health Prediction App </h2>
|
|
|
</div>
|
|
|
"""
|
|
|
st.markdown(html_temp, unsafe_allow_html=True)
|
|
|
|
|
|
st.write("Enter the Patient details:")
|
|
|
|
|
|
|
|
|
|
|
|
health_model=joblib.load("health_model.joblib")
|
|
|
|
|
|
scaler_model=joblib.load('scaler_the data_model.joblib')
|
|
|
|
|
|
|
|
|
|
|
|
col1, col2 = st.columns(2)
|
|
|
with col1:
|
|
|
|
|
|
|
|
|
age=st.slider("Slide the AGE of the Patient:",max_value=80,min_value=20)
|
|
|
|
|
|
with col2:
|
|
|
|
|
|
|
|
|
option_gen=["Female "," Male"]
|
|
|
gen=st.selectbox("Select the Gender",option_gen)
|
|
|
gender_value=option_gen.index(gen)
|
|
|
|
|
|
col1, col2 = st.columns(2)
|
|
|
with col1:
|
|
|
|
|
|
chestpain=st.slider("Slide the chestpain Value:",min_value=0,max_value=3)
|
|
|
|
|
|
with col2:
|
|
|
|
|
|
restingBP=st.slider("Slide the Resting BP of the Patient:",min_value=90,max_value=200)
|
|
|
|
|
|
col1,col2=st.columns(2)
|
|
|
with col1:
|
|
|
|
|
|
serumcholestrol=st.slider("Slide The Serum cholestrol Of a Ptient :",min_value=0,max_value=600)
|
|
|
|
|
|
with col2:
|
|
|
|
|
|
fastingbloodsugar= st.radio("Is Patient blood is Fasting:", ["YES", "NO"])
|
|
|
if fastingbloodsugar=="YES":
|
|
|
fastingbloodsugar_value=1
|
|
|
else:
|
|
|
fastingbloodsugar_value=0
|
|
|
|
|
|
col1,col2=st.columns(2)
|
|
|
|
|
|
with col1:
|
|
|
|
|
|
restingrelectro=st.slider("Slide The restingrelectro of a Patient :",min_value=0,max_value=2)
|
|
|
|
|
|
with col2:
|
|
|
|
|
|
maxheartrate=st.slider("Slide The max heart rate of the Patient :",min_value=70,max_value=200)
|
|
|
|
|
|
col1,col2=st.columns(2)
|
|
|
with col1:
|
|
|
|
|
|
exerciseangia=st.slider("Slide the exerciseangia Value:",min_value=0,max_value=1)
|
|
|
|
|
|
|
|
|
with col2:
|
|
|
|
|
|
oldpeak=st.slider("Silde the oldpeak :",max_value=6.2,min_value=0.0,value=0.1)
|
|
|
|
|
|
|
|
|
col1,col2=st.columns(2)
|
|
|
with col1:
|
|
|
|
|
|
slope=st.slider("Silde the slope of the Patient :",max_value=3,min_value=0,value=1)
|
|
|
|
|
|
with col2:
|
|
|
|
|
|
noofmajorvessels=st.slider("Silde the No of Major Vessels to a Patient :",max_value=3,min_value=0,value=1)
|
|
|
|
|
|
|
|
|
if st.button("Submit"):
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
scaler_val = scaler_model.transform([[age,gender_value,chestpain,restingBP,serumcholestrol,fastingbloodsugar_value,restingrelectro,
|
|
|
maxheartrate,exerciseangia,oldpeak,slope,noofmajorvessels]])
|
|
|
|
|
|
|
|
|
|
|
|
output = health_model.predict(scaler_val)
|
|
|
|
|
|
|
|
|
if output ==0:
|
|
|
st.write("The patient is Healthy")
|
|
|
else:
|
|
|
st.write("The Patient has Heart Disease")
|
|
|
|