Spaces:
Sleeping
Sleeping
Update app.py
Browse files
app.py
CHANGED
|
@@ -210,11 +210,7 @@ else:
|
|
| 210 |
if "app_step" not in st.session_state: st.session_state.app_step = "intro"
|
| 211 |
if "results" not in st.session_state: st.session_state.results = {}
|
| 212 |
if "train_ranges" not in st.session_state: st.session_state.train_ranges = None
|
| 213 |
-
|
| 214 |
-
if "dev_ready" not in st.session_state:
|
| 215 |
-
st.session_state.dev_ready = False
|
| 216 |
-
|
| 217 |
-
# If results already exist (page refresh) mark ready
|
| 218 |
if ("Train" in st.session_state.results) or ("Test" in st.session_state.results):
|
| 219 |
st.session_state.dev_ready = True
|
| 220 |
|
|
@@ -276,9 +272,10 @@ if st.session_state.app_step == "dev":
|
|
| 276 |
on_click=(lambda: st.session_state.update(app_step="predict")) if st.session_state.dev_ready else None,
|
| 277 |
)
|
| 278 |
|
| 279 |
-
|
| 280 |
-
|
| 281 |
st.subheader("Model Development")
|
|
|
|
|
|
|
| 282 |
if run_btn and train_test_file is not None:
|
| 283 |
with st.status("Processing…", expanded=False) as status:
|
| 284 |
book = read_book(train_test_file)
|
|
@@ -414,6 +411,11 @@ if st.session_state.app_step == "predict":
|
|
| 414 |
if "Validate" in st.session_state.results:
|
| 415 |
st.subheader("Validation Results")
|
| 416 |
sv = st.session_state.results["summary_val"]; oor_table = st.session_state.results.get("oor_table")
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 417 |
c1,c2,c3,c4 = st.columns(4)
|
| 418 |
c1.metric("points", f"{sv['n_points']}"); c2.metric("Pred min", f"{sv['pred_min']:.2f}")
|
| 419 |
c3.metric("Pred max", f"{sv['pred_max']:.2f}"); c4.metric("OOR %", f"{sv['oor_pct']:.1f}%")
|
|
@@ -425,6 +427,7 @@ if st.session_state.app_step == "predict":
|
|
| 425 |
st.info("Actual UCS values are not available in the validation data. Cross-plot cannot be generated.")
|
| 426 |
with right:
|
| 427 |
st.pyplot(depth_or_index_track(st.session_state.results["Validate"], title=None, include_actual=(TARGET in st.session_state.results["Validate"].columns)), use_container_width=True)
|
|
|
|
| 428 |
if oor_table is not None:
|
| 429 |
st.write("*Out-of-range rows (vs. Training min–max):*")
|
| 430 |
st.dataframe(oor_table, use_container_width=True)
|
|
|
|
| 210 |
if "app_step" not in st.session_state: st.session_state.app_step = "intro"
|
| 211 |
if "results" not in st.session_state: st.session_state.results = {}
|
| 212 |
if "train_ranges" not in st.session_state: st.session_state.train_ranges = None
|
| 213 |
+
if "dev_ready" not in st.session_state: st.session_state.dev_ready = False
|
|
|
|
|
|
|
|
|
|
|
|
|
| 214 |
if ("Train" in st.session_state.results) or ("Test" in st.session_state.results):
|
| 215 |
st.session_state.dev_ready = True
|
| 216 |
|
|
|
|
| 272 |
on_click=(lambda: st.session_state.update(app_step="predict")) if st.session_state.dev_ready else None,
|
| 273 |
)
|
| 274 |
|
| 275 |
+
# ---- Header + helper sentence positioned under the header (your request) ----
|
|
|
|
| 276 |
st.subheader("Model Development")
|
| 277 |
+
st.write("Upload your data to train the model and review the development performance.")
|
| 278 |
+
|
| 279 |
if run_btn and train_test_file is not None:
|
| 280 |
with st.status("Processing…", expanded=False) as status:
|
| 281 |
book = read_book(train_test_file)
|
|
|
|
| 411 |
if "Validate" in st.session_state.results:
|
| 412 |
st.subheader("Validation Results")
|
| 413 |
sv = st.session_state.results["summary_val"]; oor_table = st.session_state.results.get("oor_table")
|
| 414 |
+
|
| 415 |
+
# ---- NEW: show OOR warning above the plots when applicable ----
|
| 416 |
+
if sv["oor_pct"] > 0:
|
| 417 |
+
st.warning("Some validation inputs fall outside the **training min–max** ranges. Interpret predictions with caution.")
|
| 418 |
+
|
| 419 |
c1,c2,c3,c4 = st.columns(4)
|
| 420 |
c1.metric("points", f"{sv['n_points']}"); c2.metric("Pred min", f"{sv['pred_min']:.2f}")
|
| 421 |
c3.metric("Pred max", f"{sv['pred_max']:.2f}"); c4.metric("OOR %", f"{sv['oor_pct']:.1f}%")
|
|
|
|
| 427 |
st.info("Actual UCS values are not available in the validation data. Cross-plot cannot be generated.")
|
| 428 |
with right:
|
| 429 |
st.pyplot(depth_or_index_track(st.session_state.results["Validate"], title=None, include_actual=(TARGET in st.session_state.results["Validate"].columns)), use_container_width=True)
|
| 430 |
+
|
| 431 |
if oor_table is not None:
|
| 432 |
st.write("*Out-of-range rows (vs. Training min–max):*")
|
| 433 |
st.dataframe(oor_table, use_container_width=True)
|