Update app.py
Browse files
app.py
CHANGED
@@ -98,9 +98,15 @@ def main():
|
|
98 |
# Gender Selection
|
99 |
gender = st.selectbox("Gender", ["Female"])
|
100 |
|
101 |
-
# Location (Site) Selection
|
102 |
-
|
103 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
104 |
|
105 |
# Input patient data
|
106 |
bmd_patient = st.number_input(
|
@@ -115,16 +121,17 @@ def main():
|
|
115 |
st.write("Loaded Medication Data:")
|
116 |
st.write(medication_data.head()) # Display the loaded data for verification
|
117 |
|
118 |
-
constants = REGRESSION_CONSTANTS.get(
|
119 |
if not constants:
|
120 |
-
st.warning(f"No constants available for the selected site: {
|
121 |
return
|
122 |
|
123 |
# Generate and display predictions
|
124 |
if st.button("Predict"):
|
125 |
st.write("Prediction started...")
|
126 |
predictions = generate_predictions(medication_data, site, bmd_patient, constants['mu'], constants['sigma'])
|
127 |
-
display_results(predictions,
|
|
|
128 |
|
129 |
if __name__ == "__main__":
|
130 |
main()
|
|
|
98 |
# Gender Selection
|
99 |
gender = st.selectbox("Gender", ["Female"])
|
100 |
|
101 |
+
# Location (Site) Selection with Mapping
|
102 |
+
site_mapping = {
|
103 |
+
'Lumbar spine (L1-L4)': 'LS',
|
104 |
+
'Femoral Neck': 'FN',
|
105 |
+
'Total Hip': 'TH'
|
106 |
+
}
|
107 |
+
site_options = list(site_mapping.keys())
|
108 |
+
selected_site = st.selectbox("Select Region (Site)", site_options)
|
109 |
+
site = site_mapping[selected_site] # Map to the actual value in the dataset
|
110 |
|
111 |
# Input patient data
|
112 |
bmd_patient = st.number_input(
|
|
|
121 |
st.write("Loaded Medication Data:")
|
122 |
st.write(medication_data.head()) # Display the loaded data for verification
|
123 |
|
124 |
+
constants = REGRESSION_CONSTANTS.get(selected_site, {})
|
125 |
if not constants:
|
126 |
+
st.warning(f"No constants available for the selected site: {selected_site}")
|
127 |
return
|
128 |
|
129 |
# Generate and display predictions
|
130 |
if st.button("Predict"):
|
131 |
st.write("Prediction started...")
|
132 |
predictions = generate_predictions(medication_data, site, bmd_patient, constants['mu'], constants['sigma'])
|
133 |
+
display_results(predictions, selected_site)
|
134 |
+
|
135 |
|
136 |
if __name__ == "__main__":
|
137 |
main()
|