-
Notifications
You must be signed in to change notification settings - Fork 0
/
stream-diabetes.py
53 lines (38 loc) · 1.39 KB
/
stream-diabetes.py
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
47
48
49
50
51
52
53
import pickle
import sklearn
import streamlit as st
# Membaca Model / Load Model
# kalau beda folder copy path
diabetes_model = pickle.load(open('diabetes_model.sav', 'rb'))
# Judul web
st.title('Data Mining Prediksi Diabetes')
# Membagi kolom
col1, col2 =st.columns(2)
with col1 :
# Membuat form input
Pregnancies = st.text_input('Input Nilai Pregnancies')
with col2 :
Glucose = st.text_input('Input Nilai Glucose')
with col1 :
BloodPressure = st.text_input('Input Nilai BloodPressure')
with col2 :
SkinThickness = st.text_input('Input Nilai SkinThickness')
with col1 :
Insulin = st.text_input('Input Nilai Insulin')
with col2 :
BMI = st.text_input('Input Nilai BMI')
with col1 :
DiabetesPedigreeFunction = st.text_input('Input Nilai DiabetesPedigreeFunction')
with col2 :
Age = st.text_input('Input Nilai Age')
# Code untuk Prediction
diab_diagnosis = ''
# Membuat Button/Tombol untuk Prediction
if st.button('Test Prediksi Diabetes') :
diab_prediction = diabetes_model.predict([[Pregnancies, Glucose, BloodPressure, SkinThickness, Insulin, BMI, DiabetesPedigreeFunction,Age]])
if(diab_prediction[0] == 1):
diab_diagnosis = 'Pasien Terkena Diabetes'
else :
diab_diagnosis = 'Pasien Tidak Terkena Diabetes'
st.success(diab_diagnosis)
# MASIH ERROR HASILNYA TERKENA DIABETES SEMUA