Jegree commited on
Commit
a38d384
·
verified ·
1 Parent(s): b67d173

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +9 -15
app.py CHANGED
@@ -62,21 +62,9 @@ def diabetic_pedigree_function(mother, father, siblings):
62
 
63
 
64
  if "question_no" not in st.session_state:
65
- st.session_state.question_no = 1
66
 
67
 
68
- if st.session_state.question_no == 1:
69
-
70
- progress = st.progress((st.session_state.question_no) / 10)
71
- name = st.text_input(f"What is your name?", key=st.session_state.question_no,placeholder="Type your answer here")
72
-
73
- if st.button("Next->"):
74
- if name:
75
- st.session_state.name = name
76
- else:
77
- st.session_state.name = "Anonymous user"
78
- st.session_state.question_no += 1
79
- st.rerun()
80
 
81
  elif st.session_state.question_no == 2:
82
  progress = st.progress((st.session_state.question_no) / 10)
@@ -192,15 +180,21 @@ elif st.session_state.question_no == 10:
192
  risk = "high" if out <= 0.3 else "medium" if out <= 0.6 else "high" if out <= 0.9 else "very high"
193
 
194
  st.write(f"Risk of type 2 diabetes is {risk}")
 
195
 
196
  st.session_state.risk = risk
197
 
198
- if st.button("Reset"):
199
  for key in st.session_state.keys():
200
  del st.session_state[key]
201
  st.rerun() # Reloads the app to reflect the changes
202
 
203
- # if st.button("AI Consult"):
 
 
 
 
 
204
 
205
 
206
 
 
62
 
63
 
64
  if "question_no" not in st.session_state:
65
+ st.session_state.question_no = 2
66
 
67
 
 
 
 
 
 
 
 
 
 
 
 
 
68
 
69
  elif st.session_state.question_no == 2:
70
  progress = st.progress((st.session_state.question_no) / 10)
 
180
  risk = "high" if out <= 0.3 else "medium" if out <= 0.6 else "high" if out <= 0.9 else "very high"
181
 
182
  st.write(f"Risk of type 2 diabetes is {risk}")
183
+ st.write(f"{out}")
184
 
185
  st.session_state.risk = risk
186
 
187
+ if st.button("Retake test"):
188
  for key in st.session_state.keys():
189
  del st.session_state[key]
190
  st.rerun() # Reloads the app to reflect the changes
191
 
192
+ if st.button("Return to homepage"):
193
+ st.markdown("""
194
+ <script>
195
+ window.location.href = "https://supreme-shrestha.github.io/LifeGlyc/"
196
+ </script>
197
+ """, unsafe_allow_html = True)
198
 
199
 
200