File size: 1,730 Bytes
e9c28c2
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
import streamlit as st
import pandas as pd
import pickle

st.title("Deteksi Kesehatan Jantung Anda")

# import model
model = pickle.load(open('final_pipeline.pkl' , 'rb'))


st.write('Isi kelengkapan data dibawah')

# user input
Age = st.slider(label='Age', min_value=10, max_value=100)
Sex = st.selectbox(label='Gender', options=['M', 'F', 'Non-Binary'])
ChestPainType = st.selectbox(label='ChestPainType', options=['TA', 'ASY', 'NAP', 'ATA'])
RestingBP = st.slider(label='RestingBP', min_value=100, max_value=200, step=1)
Cholesterol = st.slider(label='Cholesterol', min_value=0, max_value=409)
FastingBS = st.selectbox(label='FastingBS', options=[0, 1])
RestingECG = st.slider(label='RestingECG', min_value=0, max_value=300)
MaxHR = st.slider(label='MaxHR', min_value=0, max_value=300)
ExerciseAngina = st.selectbox(label='ExerciseAngina',options=['Y', 'N'])
Oldpeak = st.slider(label='Oldpeak', min_value=0.0, max_value=3.0, step=0.1)
ST_Slope = st.selectbox(label='ST_Slope', options=['Flat', 'Up', 'Down'])

# convert into dataframe
data = pd.DataFrame({'Age': [Age],
                'Sex': [Sex],
                'ChestPainType': [ChestPainType],
                'RestingBP':[RestingBP],
                'FastingBS': [FastingBS],
                'RestingECG': [RestingECG],
                'MaxHR': [MaxHR],
                'ExerciseAngina': [ExerciseAngina],
                'Oldpeak': [Oldpeak],
                'ST_Slope': [ST_Slope]
                })

# interpretation
if st.button('Predict'):
    classifications = model.predict(data).tolist()[0]
    st.write('Prediction Result : ')
    if classifications == 0:
        st.subheader('Sehat')
    elif classifications == 1:
        st.subheader('Terindikasi jantung')