Spaces:
Running
Running
Update app.py
Browse files
app.py
CHANGED
@@ -56,24 +56,35 @@ def predict_new_j0_j45(age, aca_magnitude, aca_axis_deg):
|
|
56 |
def main():
|
57 |
st.title('Total Corneal Astigmatism Prediction')
|
58 |
|
59 |
-
#
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
60 |
age = st.number_input('Enter Patient Age (18-90 Years):',
|
61 |
min_value=18.0, max_value=90.0,
|
|
|
62 |
step=0.1,
|
63 |
key='age')
|
64 |
|
65 |
aca_magnitude = st.number_input('Enter ACA Magnitude (0-10 Diopters):',
|
66 |
min_value=0.0, max_value=10.0,
|
|
|
67 |
step=0.01,
|
68 |
key='aca_magnitude')
|
69 |
|
70 |
aca_axis = st.number_input('Enter ACA Axis (0-180 Degrees):',
|
71 |
min_value=0.0, max_value=180.0,
|
|
|
72 |
step=0.1,
|
73 |
key='aca_axis')
|
74 |
|
75 |
if st.button('Predict!'):
|
76 |
-
if age and aca_magnitude
|
77 |
if 18 <= age <= 90 and 0 <= aca_magnitude <= 10 and 0 <= aca_axis <= 180:
|
78 |
# Calculate initial J0 and J45
|
79 |
initial_j0, initial_j45 = calculate_initial_j0_j45(aca_magnitude, aca_axis)
|
|
|
56 |
def main():
|
57 |
st.title('Total Corneal Astigmatism Prediction')
|
58 |
|
59 |
+
# Initialize session state for input values if not already present
|
60 |
+
if 'age' not in st.session_state:
|
61 |
+
st.session_state.age = None
|
62 |
+
if 'aca_magnitude' not in st.session_state:
|
63 |
+
st.session_state.aca_magnitude = None
|
64 |
+
if 'aca_axis' not in st.session_state:
|
65 |
+
st.session_state.aca_axis = None
|
66 |
+
|
67 |
+
# Input fields using session state
|
68 |
age = st.number_input('Enter Patient Age (18-90 Years):',
|
69 |
min_value=18.0, max_value=90.0,
|
70 |
+
value=st.session_state.age if st.session_state.age is not None else None,
|
71 |
step=0.1,
|
72 |
key='age')
|
73 |
|
74 |
aca_magnitude = st.number_input('Enter ACA Magnitude (0-10 Diopters):',
|
75 |
min_value=0.0, max_value=10.0,
|
76 |
+
value=st.session_state.aca_magnitude if st.session_state.aca_magnitude is not None else None,
|
77 |
step=0.01,
|
78 |
key='aca_magnitude')
|
79 |
|
80 |
aca_axis = st.number_input('Enter ACA Axis (0-180 Degrees):',
|
81 |
min_value=0.0, max_value=180.0,
|
82 |
+
value=st.session_state.aca_axis if st.session_state.aca_axis is not None else None,
|
83 |
step=0.1,
|
84 |
key='aca_axis')
|
85 |
|
86 |
if st.button('Predict!'):
|
87 |
+
if age is not None and aca_magnitude is not None and aca_axis is not None:
|
88 |
if 18 <= age <= 90 and 0 <= aca_magnitude <= 10 and 0 <= aca_axis <= 180:
|
89 |
# Calculate initial J0 and J45
|
90 |
initial_j0, initial_j45 = calculate_initial_j0_j45(aca_magnitude, aca_axis)
|