Spaces:
Sleeping
Sleeping
Update app.py
Browse files
app.py
CHANGED
|
@@ -116,11 +116,9 @@ def add_password_gate() -> None:
|
|
| 116 |
if st.session_state.get("auth_ok", False):
|
| 117 |
return
|
| 118 |
|
| 119 |
-
# st.sidebar.image("logo.png", use_column_width=False)
|
| 120 |
-
# st.sidebar.markdown("### ST_GeoMech_UCS\nSmart Thinking • Secure Access")
|
| 121 |
st.sidebar.markdown(f"""
|
| 122 |
<div class="centered-container">
|
| 123 |
-
<img src="{inline_logo('logo.png')}" style="width:
|
| 124 |
<div style='font-weight:800;font-size:1.2rem; margin-top: 10px;'>ST_GeoMech_UCS</div>
|
| 125 |
<div style='color:#667085;'>Smart Thinking • Secure Access</div>
|
| 126 |
</div>
|
|
@@ -409,21 +407,40 @@ st.session_state.setdefault("dev_preview",False)
|
|
| 409 |
# =========================
|
| 410 |
# Branding in Sidebar
|
| 411 |
# =========================
|
| 412 |
-
# st.sidebar.image("logo.png", use_column_width=False)
|
| 413 |
-
# st.sidebar.markdown(
|
| 414 |
-
# "<div style='font-weight:800;font-size:1.2rem;'>ST_GeoMech_UCS</div>"
|
| 415 |
-
# "<div style='color:#667085;'>Real-Time UCS Tracking While Drilling</div>",
|
| 416 |
-
# unsafe_allow_html=True
|
| 417 |
-
# )
|
| 418 |
st.sidebar.markdown(f"""
|
| 419 |
<div class="centered-container">
|
| 420 |
-
<img src="{inline_logo('logo.png')}" style="width:
|
| 421 |
<div style='font-weight:800;font-size:1.2rem;'>ST_GeoMech_UCS</div>
|
| 422 |
<div style='color:#667085;'>Real-Time UCS Tracking While Drilling</div>
|
| 423 |
</div>
|
| 424 |
""", unsafe_allow_html=True
|
| 425 |
)
|
| 426 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 427 |
# =========================
|
| 428 |
# INTRO
|
| 429 |
# =========================
|
|
@@ -464,15 +481,13 @@ if st.session_state.app_step == "dev":
|
|
| 464 |
if st.sidebar.button("Proceed to Validation ▶", use_container_width=True): st.session_state.app_step="validate"; st.rerun()
|
| 465 |
if st.sidebar.button("Proceed to Prediction ▶", use_container_width=True): st.session_state.app_step="predict"; st.rerun()
|
| 466 |
|
| 467 |
-
|
| 468 |
-
|
| 469 |
-
|
| 470 |
-
|
| 471 |
-
|
| 472 |
-
|
| 473 |
-
|
| 474 |
-
else:
|
| 475 |
-
st.write("**Upload your data to build a case, then run the model to review development performance.**")
|
| 476 |
|
| 477 |
if run and st.session_state.dev_file_bytes:
|
| 478 |
book = read_book_bytes(st.session_state.dev_file_bytes)
|
|
@@ -541,8 +556,7 @@ if st.session_state.app_step == "validate":
|
|
| 541 |
if st.sidebar.button("⬅ Back to Case Building", use_container_width=True): st.session_state.app_step="dev"; st.rerun()
|
| 542 |
if st.sidebar.button("Proceed to Prediction ▶", use_container_width=True): st.session_state.app_step="predict"; st.rerun()
|
| 543 |
|
| 544 |
-
|
| 545 |
-
st.write("Upload a dataset with the same **features** and **UCS** to evaluate performance.")
|
| 546 |
|
| 547 |
if go_btn and up is not None:
|
| 548 |
book = read_book_bytes(up.getvalue())
|
|
@@ -609,8 +623,7 @@ if st.session_state.app_step == "predict":
|
|
| 609 |
go_btn = st.sidebar.button("Predict", type="primary", use_container_width=True)
|
| 610 |
if st.sidebar.button("⬅ Back to Case Building", use_container_width=True): st.session_state.app_step="dev"; st.rerun()
|
| 611 |
|
| 612 |
-
|
| 613 |
-
st.write("Upload a dataset with the feature columns (no **UCS**).")
|
| 614 |
|
| 615 |
if go_btn and up is not None:
|
| 616 |
book = read_book_bytes(up.getvalue()); name = list(book.keys())[0]
|
|
|
|
| 116 |
if st.session_state.get("auth_ok", False):
|
| 117 |
return
|
| 118 |
|
|
|
|
|
|
|
| 119 |
st.sidebar.markdown(f"""
|
| 120 |
<div class="centered-container">
|
| 121 |
+
<img src="{inline_logo('logo.png')}" style="width: 50px; height: auto; object-fit: contain;">
|
| 122 |
<div style='font-weight:800;font-size:1.2rem; margin-top: 10px;'>ST_GeoMech_UCS</div>
|
| 123 |
<div style='color:#667085;'>Smart Thinking • Secure Access</div>
|
| 124 |
</div>
|
|
|
|
| 407 |
# =========================
|
| 408 |
# Branding in Sidebar
|
| 409 |
# =========================
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 410 |
st.sidebar.markdown(f"""
|
| 411 |
<div class="centered-container">
|
| 412 |
+
<img src="{inline_logo('logo.png')}" style="width: 64px; height: auto; object-fit: contain;">
|
| 413 |
<div style='font-weight:800;font-size:1.2rem;'>ST_GeoMech_UCS</div>
|
| 414 |
<div style='color:#667085;'>Real-Time UCS Tracking While Drilling</div>
|
| 415 |
</div>
|
| 416 |
""", unsafe_allow_html=True
|
| 417 |
)
|
| 418 |
|
| 419 |
+
# =========================
|
| 420 |
+
# Reusable Sticky Header Function
|
| 421 |
+
# =========================
|
| 422 |
+
def sticky_header(title, message):
|
| 423 |
+
st.markdown(
|
| 424 |
+
f"""
|
| 425 |
+
<style>
|
| 426 |
+
.sticky-container {{
|
| 427 |
+
position: sticky;
|
| 428 |
+
top: 0;
|
| 429 |
+
background-color: white;
|
| 430 |
+
z-index: 100;
|
| 431 |
+
padding-top: 10px;
|
| 432 |
+
padding-bottom: 10px;
|
| 433 |
+
border-bottom: 1px solid #eee;
|
| 434 |
+
}}
|
| 435 |
+
</style>
|
| 436 |
+
<div class="sticky-container">
|
| 437 |
+
<h3>{title}</h3>
|
| 438 |
+
<p>{message}</p>
|
| 439 |
+
</div>
|
| 440 |
+
""",
|
| 441 |
+
unsafe_allow_html=True
|
| 442 |
+
)
|
| 443 |
+
|
| 444 |
# =========================
|
| 445 |
# INTRO
|
| 446 |
# =========================
|
|
|
|
| 481 |
if st.sidebar.button("Proceed to Validation ▶", use_container_width=True): st.session_state.app_step="validate"; st.rerun()
|
| 482 |
if st.sidebar.button("Proceed to Prediction ▶", use_container_width=True): st.session_state.app_step="predict"; st.rerun()
|
| 483 |
|
| 484 |
+
# Apply sticky header
|
| 485 |
+
if st.session_state.dev_file_loaded and st.session_state.dev_preview:
|
| 486 |
+
sticky_header("Case Building", "Previewed ✓ — now click **Run Model**.")
|
| 487 |
+
elif st.session_state.dev_file_loaded:
|
| 488 |
+
sticky_header("Case Building", "📄 **Preview uploaded data** using the sidebar button, then click **Run Model**.")
|
| 489 |
+
else:
|
| 490 |
+
sticky_header("Case Building", "**Upload your data to build a case, then run the model to review development performance.**")
|
|
|
|
|
|
|
| 491 |
|
| 492 |
if run and st.session_state.dev_file_bytes:
|
| 493 |
book = read_book_bytes(st.session_state.dev_file_bytes)
|
|
|
|
| 556 |
if st.sidebar.button("⬅ Back to Case Building", use_container_width=True): st.session_state.app_step="dev"; st.rerun()
|
| 557 |
if st.sidebar.button("Proceed to Prediction ▶", use_container_width=True): st.session_state.app_step="predict"; st.rerun()
|
| 558 |
|
| 559 |
+
sticky_header("Validate the Model", "Upload a dataset with the same **features** and **UCS** to evaluate performance.")
|
|
|
|
| 560 |
|
| 561 |
if go_btn and up is not None:
|
| 562 |
book = read_book_bytes(up.getvalue())
|
|
|
|
| 623 |
go_btn = st.sidebar.button("Predict", type="primary", use_container_width=True)
|
| 624 |
if st.sidebar.button("⬅ Back to Case Building", use_container_width=True): st.session_state.app_step="dev"; st.rerun()
|
| 625 |
|
| 626 |
+
sticky_header("Prediction", "Upload a dataset with the feature columns (no **UCS**).")
|
|
|
|
| 627 |
|
| 628 |
if go_btn and up is not None:
|
| 629 |
book = read_book_bytes(up.getvalue()); name = list(book.keys())[0]
|