Update app.py
Browse files
app.py
CHANGED
@@ -78,12 +78,12 @@ elif st.session_state.question_no == 2:
|
|
78 |
st.write(f"""
|
79 |
Name = {st.session_state.name}
|
80 |
""")
|
81 |
-
age = st.
|
82 |
if st.button("Next->"):
|
83 |
if not is_number(age):
|
84 |
st.warning("Please enter a valid age")
|
85 |
else:
|
86 |
-
st.session_state.age = age
|
87 |
st.session_state.question_no += 1
|
88 |
|
89 |
elif st.session_state.question_no == 3:
|
@@ -106,10 +106,13 @@ elif st.session_state.question_no == 4:
|
|
106 |
Age = {st.session_state.age}\n
|
107 |
Gender = {st.session_state.gender}
|
108 |
""")
|
109 |
-
pregnancies = st.
|
110 |
if st.button("Next->"):
|
111 |
-
|
112 |
-
|
|
|
|
|
|
|
113 |
|
114 |
elif st.session_state.question_no == 5:
|
115 |
st.write(f"""
|
@@ -118,10 +121,13 @@ elif st.session_state.question_no == 5:
|
|
118 |
Gender = {st.session_state.gender}\n
|
119 |
No of pregnancies = {st.session_state.pregnancies}
|
120 |
""")
|
121 |
-
glucose = st.
|
122 |
if st.button("Next->"):
|
123 |
-
|
124 |
-
|
|
|
|
|
|
|
125 |
|
126 |
elif st.session_state.question_no == 6:
|
127 |
st.write(f"""
|
@@ -131,10 +137,13 @@ elif st.session_state.question_no == 6:
|
|
131 |
No of pregnancies = {st.session_state.pregnancies}\n
|
132 |
Glucose Level = {st.session_state.glucose}
|
133 |
""")
|
134 |
-
bp = st.
|
135 |
if st.button("Next->"):
|
136 |
-
|
137 |
-
|
|
|
|
|
|
|
138 |
|
139 |
elif st.session_state.question_no == 7:
|
140 |
st.write(f"""
|
@@ -145,10 +154,13 @@ elif st.session_state.question_no == 7:
|
|
145 |
Glucose Level = {st.session_state.glucose}\n
|
146 |
BT Level = {st.session_state.bp}
|
147 |
""")
|
148 |
-
height = st.
|
149 |
if st.button("Next->"):
|
150 |
-
|
151 |
-
|
|
|
|
|
|
|
152 |
|
153 |
elif st.session_state.question_no == 8:
|
154 |
st.write(f"""
|
@@ -160,11 +172,14 @@ elif st.session_state.question_no == 8:
|
|
160 |
BT Level = {st.session_state.bp}\n
|
161 |
Height = {st.session_state.height}
|
162 |
""")
|
163 |
-
weight = st.
|
164 |
if st.button("Next->"):
|
165 |
-
|
166 |
-
|
167 |
-
|
|
|
|
|
|
|
168 |
|
169 |
elif st.session_state.question_no == 9:
|
170 |
st.write(f"""
|
@@ -181,13 +196,16 @@ elif st.session_state.question_no == 9:
|
|
181 |
st.write("Select the members with diabetes in your family")
|
182 |
diabeticMother = st.checkbox("Mother")
|
183 |
diabeticFather = st.checkbox("Father")
|
184 |
-
diabeticSibling = st.
|
185 |
if st.button("Next->"):
|
186 |
-
|
187 |
-
|
188 |
-
|
189 |
-
|
190 |
-
|
|
|
|
|
|
|
191 |
|
192 |
elif st.session_state.question_no == 10:
|
193 |
st.write(f"""
|
|
|
78 |
st.write(f"""
|
79 |
Name = {st.session_state.name}
|
80 |
""")
|
81 |
+
age = st.text_input(f"{st.session_state.question_no}How old are you?", key=st.session_state.question_no, placeholder="Type your answer")
|
82 |
if st.button("Next->"):
|
83 |
if not is_number(age):
|
84 |
st.warning("Please enter a valid age")
|
85 |
else:
|
86 |
+
st.session_state.age = int(age)
|
87 |
st.session_state.question_no += 1
|
88 |
|
89 |
elif st.session_state.question_no == 3:
|
|
|
106 |
Age = {st.session_state.age}\n
|
107 |
Gender = {st.session_state.gender}
|
108 |
""")
|
109 |
+
pregnancies = st.text_input(f"{st.session_state.question_no}How many times have you been pregnant?", key=st.session_state.question_no)
|
110 |
if st.button("Next->"):
|
111 |
+
if not is_number(pregnancies):
|
112 |
+
st.warning("Please enter a vaild Input!!!!")
|
113 |
+
else:
|
114 |
+
st.session_state.pregnancies = int(pregnancies)
|
115 |
+
st.session_state.question_no += 1
|
116 |
|
117 |
elif st.session_state.question_no == 5:
|
118 |
st.write(f"""
|
|
|
121 |
Gender = {st.session_state.gender}\n
|
122 |
No of pregnancies = {st.session_state.pregnancies}
|
123 |
""")
|
124 |
+
glucose = st.text_input(f"{st.session_state.question_no}Enter your glucose level", key=st.session_state.question_no)
|
125 |
if st.button("Next->"):
|
126 |
+
if not is_number(glucose):
|
127 |
+
st.warning("Please enter a valid input!!!!")
|
128 |
+
else:
|
129 |
+
st.session_state.glucose = int(glucose)
|
130 |
+
st.session_state.question_no += 1
|
131 |
|
132 |
elif st.session_state.question_no == 6:
|
133 |
st.write(f"""
|
|
|
137 |
No of pregnancies = {st.session_state.pregnancies}\n
|
138 |
Glucose Level = {st.session_state.glucose}
|
139 |
""")
|
140 |
+
bp = st.text_input(f"{st.session_state.question_no}Enter your blood pressure", key=st.session_state.question_no)
|
141 |
if st.button("Next->"):
|
142 |
+
if not is_number(bp):
|
143 |
+
st.warning("Please enter valid input!!!")
|
144 |
+
else:
|
145 |
+
st.session_state.bp = int(bp)
|
146 |
+
st.session_state.question_no += 1
|
147 |
|
148 |
elif st.session_state.question_no == 7:
|
149 |
st.write(f"""
|
|
|
154 |
Glucose Level = {st.session_state.glucose}\n
|
155 |
BT Level = {st.session_state.bp}
|
156 |
""")
|
157 |
+
height = st.text_input(f"{st.session_state.question_no}Enter your height in cm:")
|
158 |
if st.button("Next->"):
|
159 |
+
if not is_number(height):
|
160 |
+
st.warning("Please enter valid input!!!!")
|
161 |
+
else:
|
162 |
+
st.session_state.height = float(height/100)
|
163 |
+
st.session_state.question_no += 1
|
164 |
|
165 |
elif st.session_state.question_no == 8:
|
166 |
st.write(f"""
|
|
|
172 |
BT Level = {st.session_state.bp}\n
|
173 |
Height = {st.session_state.height}
|
174 |
""")
|
175 |
+
weight = st.text_input(f"{st.session_state.question_no}Enter your weight in KG")
|
176 |
if st.button("Next->"):
|
177 |
+
if not is_number(weight):
|
178 |
+
st.warning("Please enter valid input!!!")
|
179 |
+
else:
|
180 |
+
st.session_state.weight = float(weight)
|
181 |
+
st.session_state.bmi = calculate_bmi(st.session_state.weight, st.session_state.height)
|
182 |
+
st.session_state.question_no += 1
|
183 |
|
184 |
elif st.session_state.question_no == 9:
|
185 |
st.write(f"""
|
|
|
196 |
st.write("Select the members with diabetes in your family")
|
197 |
diabeticMother = st.checkbox("Mother")
|
198 |
diabeticFather = st.checkbox("Father")
|
199 |
+
diabeticSibling = st.text_input("Enter the number of diabetic siblings in your family", key=st.session_state.question_no)
|
200 |
if st.button("Next->"):
|
201 |
+
if not is_number(diabeticSibling):
|
202 |
+
st.warning("Please enter valid number for diabetic siblings!!!!")
|
203 |
+
else:
|
204 |
+
st.session_state.diabeticMother = 1 if diabeticMother else 0
|
205 |
+
st.session_state.diabeticFather = 1 if diabeticFather else 0
|
206 |
+
st.session_state.diabeticSibling = int(diabeticSibling)
|
207 |
+
st.session_state.dpf = diabetic_pedigree_function(st.session_state.diabeticMother, st.session_state.diabeticFather, st.session_state.diabeticSibling, st.session_state.diabeticSibling)
|
208 |
+
st.session_state.question_no += 1
|
209 |
|
210 |
elif st.session_state.question_no == 10:
|
211 |
st.write(f"""
|