Jegree commited on
Commit
afe1a6f
·
verified ·
1 Parent(s): c3d912a

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +4 -3
app.py CHANGED
@@ -3,6 +3,7 @@ import json
3
  import numpy as np
4
  import streamlit as st
5
  import onnxruntime as rt
 
6
  from sklearn.preprocessing import StandardScaler
7
  from sklearn.ensemble import RandomForestClassifier
8
 
@@ -177,7 +178,7 @@ elif st.session_state.question_no == 10:
177
  out = modelSession.run(None, {input_name: test_data})[1]
178
  # out = model.predict([st.session_state.pregnancies, st.session_state.glucose, st.session_state.bp, st.session_state.bmi, st.session_state.dpf])
179
  out = softmax(list(out[0].values()))[1]
180
- out = (out - 0.44)*33.3333
181
  out = 0 if out < 0 else 1 if out > 1 else out
182
  risk = "low" if out <= 0.3 else "medium" if out <= 0.6 else "high" if out <= 0.9 else "very high"
183
 
@@ -192,11 +193,11 @@ elif st.session_state.question_no == 10:
192
  st.rerun() # Reloads the app to reflect the changes
193
 
194
  if st.button("Return to homepage"):
195
- st.markdown("""
196
  <script>
197
  window.location.href = "https://supreme-shrestha.github.io/LifeGlyc/";
198
  </script>
199
- """, unsafe_allow_html = True)
200
 
201
 
202
 
 
3
  import numpy as np
4
  import streamlit as st
5
  import onnxruntime as rt
6
+ import streamlit.components.v1 as components
7
  from sklearn.preprocessing import StandardScaler
8
  from sklearn.ensemble import RandomForestClassifier
9
 
 
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
 
 
193
  st.rerun() # Reloads the app to reflect the changes
194
 
195
  if st.button("Return to homepage"):
196
+ components.html("""
197
  <script>
198
  window.location.href = "https://supreme-shrestha.github.io/LifeGlyc/";
199
  </script>
200
+ """, height = 0,)
201
 
202
 
203