Spaces:
Runtime error
Runtime error
Upload 3 files
Browse files- app.py +29 -0
- model functional improve.h5 +3 -0
- pipeline_knn.pkl +3 -0
app.py
ADDED
@@ -0,0 +1,29 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
import pandas as pd
|
2 |
+
import numpy as np
|
3 |
+
import joblib
|
4 |
+
import streamlit as st
|
5 |
+
|
6 |
+
with open('pipeline_knn.pkl', 'rb') as file_1:
|
7 |
+
full_imbhandling = joblib.load(file_1)
|
8 |
+
|
9 |
+
st.header('Stroke Prediction')
|
10 |
+
|
11 |
+
age = st.number_input('Age : ', 1, 82)
|
12 |
+
average_glucose_level = st.number_input('Average Glucose Level : ', 55.12, 271.74, step=0.1)
|
13 |
+
bmi = st.number_input('BMI : ', 10.3, 97.6, step=0.1)
|
14 |
+
hypertension = st.radio('Hypertension 0=yes 1=no : ', (0, 1))
|
15 |
+
heart_disease = st.radio('Heart Disease 0=yes 1=no : ', (0, 1))
|
16 |
+
ever_married = st.radio('Married Status : ', ('Yes', 'No'))
|
17 |
+
smoking_status = st.selectbox('Smoking Status : ', ('formerly smoked', 'never smoked', 'smokes', 'Unknown'))
|
18 |
+
|
19 |
+
if st.button('Predict'):
|
20 |
+
data_inf = pd.DataFrame({'age' : [age],
|
21 |
+
'avg_glucose_level' : [average_glucose_level],
|
22 |
+
'bmi' : [bmi],
|
23 |
+
'hypertension' : [hypertension],
|
24 |
+
'heart_disease' : [heart_disease],
|
25 |
+
'ever_married' : [ever_married],
|
26 |
+
'smoking_status' : [smoking_status]})
|
27 |
+
|
28 |
+
hasil = 'Not Stroke' if full_imbhandling.predict(data_inf) == 0 else 'Stroke'
|
29 |
+
st.header(f'Prediksi = {hasil}')
|
model functional improve.h5
ADDED
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
1 |
+
version https://git-lfs.github.com/spec/v1
|
2 |
+
oid sha256:50a56b7362b962c01538217d2fe453925656f8c42b6b2d37f181c7b2db8a322b
|
3 |
+
size 170632
|
pipeline_knn.pkl
ADDED
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
1 |
+
version https://git-lfs.github.com/spec/v1
|
2 |
+
oid sha256:77afea2bb61e2fdd5e47ed0c047d57de92e13a10562b02ccf2282aa4559da176
|
3 |
+
size 1871530
|