Skip to content

Commit f6fb417

Browse files
committed
fix: package Streamlit production model and safe controls
1 parent 65ac95b commit f6fb417

3 files changed

Lines changed: 25 additions & 9 deletions

File tree

.gitignore

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -210,3 +210,7 @@ monitoring/snapshots/evidently_monitoring_summary.json
210210

211211
# Local runtime secrets and wrapper logs
212212
.runtime/
213+
214+
# Production model required by the public Streamlit demo
215+
!models/trained/
216+
!models/trained/final_champion_model.joblib

app/Executive_Overview.py

Lines changed: 21 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -556,19 +556,31 @@ def render_executive_sidebar(
556556
),
557557
)
558558

559-
maximum_target = max(eligible_visitors, 1)
560-
default_target = min(maximum_target, max(1, round(maximum_target * 0.5)))
559+
# STREAMLIT CLOUD: safely handle zero or one eligible visitor.
560+
maximum_target = max(eligible_visitors, 0)
561+
default_target = (
562+
min(maximum_target, max(1, round(maximum_target * 0.5)))
563+
if maximum_target > 0
564+
else 0
565+
)
561566

562567
control_1, control_2, control_3 = st.columns(3)
563568

564569
with control_1:
565-
target_size = st.slider(
566-
"Campaign target size",
567-
min_value=1,
568-
max_value=maximum_target,
569-
value=default_target,
570-
help="Cannot exceed the threshold-eligible holdout audience.",
571-
)
570+
if maximum_target <= 1:
571+
target_size = maximum_target
572+
st.metric("Campaign target size", f"{target_size:,}")
573+
st.caption(
574+
"The available evidence currently has no adjustable target range."
575+
)
576+
else:
577+
target_size = st.slider(
578+
"Campaign target size",
579+
min_value=1,
580+
max_value=maximum_target,
581+
value=default_target,
582+
help="Cannot exceed the threshold-eligible holdout audience.",
583+
)
572584

573585
with control_2:
574586
contact_cost = st.number_input(
286 KB
Binary file not shown.

0 commit comments

Comments
 (0)