Update app.py
Browse files
app.py
CHANGED
@@ -1,4 +1,17 @@
|
|
|
|
1 |
import streamlit as st
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2 |
|
3 |
def calculate_bmi(weight, height):
|
4 |
# Calculate BMI
|
@@ -123,7 +136,9 @@ elif st.session_state.question_no == 9:
|
|
123 |
st.session_state.dpf = diabetic_pedigree_function(st.session_state.diabeticMother, st.session_state.diabeticFather, st.session_state.diabeticSibling, st.session_state.diabeticSibling)
|
124 |
st.session_state.question_no += 1
|
125 |
|
126 |
-
|
|
|
|
|
127 |
|
128 |
|
129 |
|
|
|
1 |
+
import json
|
2 |
import streamlit as st
|
3 |
+
from sklearn.preprocessing import StandardScaler
|
4 |
+
from sklearn.ensemble import RandomForestClassifier
|
5 |
+
|
6 |
+
with open("random_forest_model.json", "r") as f:
|
7 |
+
params = json.load(f)
|
8 |
+
model = RandomForestClassifier(**params)
|
9 |
+
del(params)
|
10 |
+
|
11 |
+
with open("scaler.json", "r") as f:
|
12 |
+
params = json.load(f)
|
13 |
+
scaler = StandardScaler(**params)
|
14 |
+
del(params)
|
15 |
|
16 |
def calculate_bmi(weight, height):
|
17 |
# Calculate BMI
|
|
|
136 |
st.session_state.dpf = diabetic_pedigree_function(st.session_state.diabeticMother, st.session_state.diabeticFather, st.session_state.diabeticSibling, st.session_state.diabeticSibling)
|
137 |
st.session_state.question_no += 1
|
138 |
|
139 |
+
elif st.session_state.question_no == 10:
|
140 |
+
out = model.predict([st.session_state.pregnancies, st.session_state.glucose, st.session.state.bp, st.bmi, st.dpf])
|
141 |
+
st.write(out)
|
142 |
|
143 |
|
144 |
|