import streamlit as st import pandas as pd import joblib st.title("Heart Disease Prediction") gender = st.radio("Select Your Gender",['Male','Female']) if gender=="Male": gender=1 else: gender=0 age = st.slider("Select Your Age") cigsPerDay = st.number_input("Enter No.of Ciggarettes Per Day") BPMeds = st.radio("Do you take BP Medicines?",["True","False"]) if BPMeds=="True": BPMeds=1.0 else: BPMeds=0.0 prevStroke = st.radio("Do you have any prevalent stroke?",["True","False"]) if prevStroke=="True": prevStroke=1 else: prevStroke=0 prevalentHyp = st.radio("Do you have any prevalent hypertension?",["True","False"]) if prevalentHyp=="True": prevalentHyp=1 else: prevalentHyp=0 diabetes = st.radio("Do you have diabetes?",["True","False"]) if diabetes=="True": diabetes=1 else: diabetes=0 totChol = st.number_input("Enter your cholestrol level") sysBP = st.number_input("Enter your systole blood pressure level") diaBP = st.number_input("Enter your diastole blood pressure level") bmi = st.number_input("Enter your BMI") heart_rate = st.number_input("Enter your heart beats per minute.") if st.button("Predict"): model = joblib.load("heart_model.h5") prediction = model.predict([[gender,age,cigsPerDay,BPMeds,prevStroke,prevalentHyp,diabetes,totChol,sysBP,diaBP,bmi,heart_rate]]) if prediction[0] == 0: prediction = "You are not at a risk of getting a heart disease." st.success(prediction) else: prediction = "You are at risk of getting a heart disease." st.success(prediction)