Jegree commited on
Commit
03d2590
·
verified ·
1 Parent(s): c439f2d

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +11 -9
app.py CHANGED
@@ -175,16 +175,18 @@ elif st.session_state.question_no == 10:
175
  test_data = np.array(transformed_data, dtype=np.float32)
176
 
177
  # Run the model
178
- out = modelSession.run(None, {input_name: test_data})[1]
179
  # out = model.predict([st.session_state.pregnancies, st.session_state.glucose, st.session_state.bp, st.session_state.bmi, st.session_state.dpf])
180
- out = softmax(list(out[0].values()))[1]
181
- out = (out - 0.45)*50
182
- out = 0 if out < 0 else 1 if out > 1 else out
183
- risk = "low" if out <= 0.3 else "medium" if out <= 0.6 else "high" if out <= 0.9 else "very high"
184
-
185
- st.write(f"Risk of type 2 diabetes is {risk}")
186
-
187
- st.session_state.risk = risk
 
 
188
 
189
  if st.button("Retake test"):
190
  for key in st.session_state.keys():
 
175
  test_data = np.array(transformed_data, dtype=np.float32)
176
 
177
  # Run the model
178
+ out = modelSession.run(None, {input_name: test_data})[0]
179
  # out = model.predict([st.session_state.pregnancies, st.session_state.glucose, st.session_state.bp, st.session_state.bmi, st.session_state.dpf])
180
+ out = out[0]
181
+
182
+ if out == 0:
183
+ st.markdown("""
184
+ <b>CONGRATS</b> You are not in risk of diabetes type 2
185
+ """)
186
+ else:
187
+ st.markdown("""
188
+ You are in risk of type 2 diabetes. We recommend you to visit doctor as soon as possible.
189
+ """)
190
 
191
  if st.button("Retake test"):
192
  for key in st.session_state.keys():