Spaces:
Running
Running
Update app.py
Browse files
app.py
CHANGED
@@ -30,8 +30,8 @@ model_j45.eval()
|
|
30 |
def calculate_initial_j0_j45(magnitude, axis):
|
31 |
"""Calculate initial J0 and J45 from magnitude and axis."""
|
32 |
axis_rad = math.radians(axis)
|
33 |
-
j0 = magnitude * math.cos(2 * axis_rad)
|
34 |
-
j45 = magnitude * math.sin(2 * axis_rad)
|
35 |
return j0, j45
|
36 |
|
37 |
def predict_new_j0_j45(age, aca_magnitude, aca_axis):
|
@@ -80,12 +80,12 @@ def main():
|
|
80 |
# Calculate predicted magnitude and axis
|
81 |
predicted_magnitude, predicted_axis = calculate_magnitude_and_axis(new_j0, new_j45)
|
82 |
|
83 |
-
st.success(f'Predicted Total Corneal Astigmatism Magnitude: {predicted_magnitude:.
|
84 |
st.success(f'Predicted Total Corneal Astigmatism Axis: {predicted_axis:.1f}°')
|
85 |
|
86 |
# Display intermediate values for verification
|
87 |
-
st.info(f'Initial J0: {initial_j0:.
|
88 |
-
st.info(f'Predicted J0: {new_j0:.
|
89 |
else:
|
90 |
st.error('Please ensure all inputs are within the specified ranges.')
|
91 |
|
|
|
30 |
def calculate_initial_j0_j45(magnitude, axis):
|
31 |
"""Calculate initial J0 and J45 from magnitude and axis."""
|
32 |
axis_rad = math.radians(axis)
|
33 |
+
j0 = round(magnitude * math.cos(2 * axis_rad), 2)
|
34 |
+
j45 = round(magnitude * math.sin(2 * axis_rad), 2)
|
35 |
return j0, j45
|
36 |
|
37 |
def predict_new_j0_j45(age, aca_magnitude, aca_axis):
|
|
|
80 |
# Calculate predicted magnitude and axis
|
81 |
predicted_magnitude, predicted_axis = calculate_magnitude_and_axis(new_j0, new_j45)
|
82 |
|
83 |
+
st.success(f'Predicted Total Corneal Astigmatism Magnitude: {predicted_magnitude:.2f} D')
|
84 |
st.success(f'Predicted Total Corneal Astigmatism Axis: {predicted_axis:.1f}°')
|
85 |
|
86 |
# Display intermediate values for verification
|
87 |
+
st.info(f'Initial J0: {initial_j0:.2f}, Initial J45: {initial_j45:.2f}')
|
88 |
+
st.info(f'Predicted J0: {new_j0:.2f}, Predicted J45: {new_j45:.2f}')
|
89 |
else:
|
90 |
st.error('Please ensure all inputs are within the specified ranges.')
|
91 |
|