Spaces:
Sleeping
Sleeping
Pragya Jatav
commited on
Commit
·
1581ecc
1
Parent(s):
64a563b
version changes
Browse files- pages/2_Scenario_Planner.py +97 -21
- summary_df.pkl +1 -1
pages/2_Scenario_Planner.py
CHANGED
@@ -1079,16 +1079,34 @@ if auth_status == True:
|
|
1079 |
|
1080 |
st.markdown("""<hr class="spends-heading-seperator">""", unsafe_allow_html=True)
|
1081 |
_columns = st.columns((1, 1, 1, 1, 1))
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1082 |
with _columns[0]:
|
1083 |
-
|
|
|
1084 |
with _columns[1]:
|
1085 |
-
|
|
|
1086 |
with _columns[2]:
|
1087 |
-
|
|
|
1088 |
with _columns[3]:
|
1089 |
-
|
|
|
1090 |
with _columns[4]:
|
1091 |
-
|
|
|
1092 |
st.markdown("""<hr class="spends-heading-seperator">""", unsafe_allow_html=True)
|
1093 |
|
1094 |
_columns = st.columns((1, 1, 1, 1, 1))
|
@@ -1104,7 +1122,7 @@ if auth_status == True:
|
|
1104 |
"""
|
1105 |
<style>
|
1106 |
.custom-text {
|
1107 |
-
font-size:
|
1108 |
color: #6bbf6b ; /* Adjust text color */
|
1109 |
}
|
1110 |
</style>
|
@@ -1116,7 +1134,7 @@ if auth_status == True:
|
|
1116 |
"""
|
1117 |
<style>
|
1118 |
.custom-text {
|
1119 |
-
font-size:
|
1120 |
color: #ff6868; /* Adjust text color */
|
1121 |
}
|
1122 |
</style>
|
@@ -1151,7 +1169,7 @@ if auth_status == True:
|
|
1151 |
"""
|
1152 |
<style>
|
1153 |
.custom-text {
|
1154 |
-
font-size:
|
1155 |
color:#6bbf6b ; /* Adjust text color */
|
1156 |
}
|
1157 |
</style>
|
@@ -1163,7 +1181,7 @@ if auth_status == True:
|
|
1163 |
"""
|
1164 |
<style>
|
1165 |
.custom-text {
|
1166 |
-
font-size:
|
1167 |
color: #ff6868; /* Adjust text color */
|
1168 |
}
|
1169 |
</style>
|
@@ -1184,6 +1202,57 @@ if auth_status == True:
|
|
1184 |
"""<hr class="spends-child-seperator">""",
|
1185 |
unsafe_allow_html=True,
|
1186 |
)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1187 |
# st.markdown("""<hr class="spends-heading-seperator">""", unsafe_allow_html=True)
|
1188 |
|
1189 |
# header_df.reset_index(inplace=True)
|
@@ -1282,14 +1351,14 @@ if auth_status == True:
|
|
1282 |
# )
|
1283 |
|
1284 |
with st.expander("Channel Spends Simulator", expanded=True):
|
1285 |
-
_columns1 = st.columns((2, 2, 1,
|
1286 |
with _columns1[0]:
|
1287 |
optimization_selection = st.selectbox(
|
1288 |
"Optimize", options=["Media Spends", target], key="optimization_key"
|
1289 |
)
|
1290 |
|
1291 |
with _columns1[1]:
|
1292 |
-
st.markdown("#")
|
1293 |
# if st.checkbox(
|
1294 |
# label="Optimize all Channels",
|
1295 |
# key="optimze_all_channels",
|
@@ -1306,7 +1375,6 @@ if auth_status == True:
|
|
1306 |
)
|
1307 |
|
1308 |
with _columns1[2]:
|
1309 |
-
st.markdown("#")
|
1310 |
# st.button(
|
1311 |
# "Optimize",
|
1312 |
# on_click=optimize,
|
@@ -1317,7 +1385,7 @@ if auth_status == True:
|
|
1317 |
optimize_placeholder = st.empty()
|
1318 |
|
1319 |
with _columns1[3]:
|
1320 |
-
st.markdown("#")
|
1321 |
st.button(
|
1322 |
"Reset",
|
1323 |
on_click=reset_scenario,
|
@@ -1327,7 +1395,7 @@ if auth_status == True:
|
|
1327 |
# st.write(target)
|
1328 |
|
1329 |
|
1330 |
-
_columns2 = st.columns((2, 2, 2))
|
1331 |
if st.session_state["optimization_key"] == "Media Spends":
|
1332 |
with _columns2[0]:
|
1333 |
spend_input = st.text_input(
|
@@ -1381,6 +1449,14 @@ if auth_status == True:
|
|
1381 |
on_change=update_sales,
|
1382 |
)
|
1383 |
with _columns2[2]:
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1384 |
min_value = round(_scenario.actual_total_sales * 0.5)
|
1385 |
max_value = round(_scenario.actual_total_sales * 1.5)
|
1386 |
# st.write(min_value)
|
@@ -1392,13 +1468,13 @@ if auth_status == True:
|
|
1392 |
for value in range(min_value, max_value + 1, int(100))
|
1393 |
]
|
1394 |
|
1395 |
-
st.select_slider(
|
1396 |
-
|
1397 |
-
|
1398 |
-
|
1399 |
-
|
1400 |
-
|
1401 |
-
)
|
1402 |
|
1403 |
if (
|
1404 |
not st.session_state["allow_sales_update"]
|
|
|
1079 |
|
1080 |
st.markdown("""<hr class="spends-heading-seperator">""", unsafe_allow_html=True)
|
1081 |
_columns = st.columns((1, 1, 1, 1, 1))
|
1082 |
+
st.markdown(
|
1083 |
+
"""
|
1084 |
+
<style>
|
1085 |
+
.custom-text_head {
|
1086 |
+
font-size: 36px; /* Adjust font size */
|
1087 |
+
color: 'blue' ; /* Adjust text color */
|
1088 |
+
|
1089 |
+
font-weight: bold;
|
1090 |
+
}
|
1091 |
+
</style>
|
1092 |
+
""",
|
1093 |
+
unsafe_allow_html=True
|
1094 |
+
)
|
1095 |
with _columns[0]:
|
1096 |
+
st.markdown(f'<p class="custom-text_head">{"Metrics"}</p>', unsafe_allow_html=True)
|
1097 |
+
# generate_spending_header("Metric")
|
1098 |
with _columns[1]:
|
1099 |
+
st.markdown(f'<p class="custom-text_head">{"Actual"}</p>', unsafe_allow_html=True)
|
1100 |
+
# generate_spending_header("Actual")
|
1101 |
with _columns[2]:
|
1102 |
+
st.markdown(f'<p class="custom-text_head">{"Simulated"}</p>', unsafe_allow_html=True)
|
1103 |
+
# generate_spending_header("Optimised")
|
1104 |
with _columns[3]:
|
1105 |
+
st.markdown(f'<p class="custom-text_head">{"Change"}</p>', unsafe_allow_html=True)
|
1106 |
+
# generate_spending_header("Change")
|
1107 |
with _columns[4]:
|
1108 |
+
st.markdown(f'<p class="custom-text_head">{"Change Percent"}</p>', unsafe_allow_html=True)
|
1109 |
+
# generate_spending_header("Change Percent")
|
1110 |
st.markdown("""<hr class="spends-heading-seperator">""", unsafe_allow_html=True)
|
1111 |
|
1112 |
_columns = st.columns((1, 1, 1, 1, 1))
|
|
|
1122 |
"""
|
1123 |
<style>
|
1124 |
.custom-text {
|
1125 |
+
font-size: 36px; /* Adjust font size */
|
1126 |
color: #6bbf6b ; /* Adjust text color */
|
1127 |
}
|
1128 |
</style>
|
|
|
1134 |
"""
|
1135 |
<style>
|
1136 |
.custom-text {
|
1137 |
+
font-size: 36px; /* Adjust font size */
|
1138 |
color: #ff6868; /* Adjust text color */
|
1139 |
}
|
1140 |
</style>
|
|
|
1169 |
"""
|
1170 |
<style>
|
1171 |
.custom-text {
|
1172 |
+
font-size: 36px; /* Adjust font size */
|
1173 |
color:#6bbf6b ; /* Adjust text color */
|
1174 |
}
|
1175 |
</style>
|
|
|
1181 |
"""
|
1182 |
<style>
|
1183 |
.custom-text {
|
1184 |
+
font-size: 36px; /* Adjust font size */
|
1185 |
color: #ff6868; /* Adjust text color */
|
1186 |
}
|
1187 |
</style>
|
|
|
1202 |
"""<hr class="spends-child-seperator">""",
|
1203 |
unsafe_allow_html=True,
|
1204 |
)
|
1205 |
+
|
1206 |
+
_columns = st.columns((1, 1, 1, 1, 1))
|
1207 |
+
ef1 = (_scenario.actual_total_spends/_scenario.actual_total_sales)
|
1208 |
+
ef2 = (_scenario.modified_total_spends/_scenario.modified_total_sales)
|
1209 |
+
with _columns[0]:
|
1210 |
+
st.header("Cost Per Prospect")
|
1211 |
+
with _columns[1]:
|
1212 |
+
st.metric(label="", value='$ '+numerize(ef1,0))
|
1213 |
+
with _columns[2]:
|
1214 |
+
st.metric(label="", value='$ '+numerize(ef2,0))
|
1215 |
+
with _columns[3]:
|
1216 |
+
|
1217 |
+
if ef2 >= ef1:
|
1218 |
+
st.markdown(
|
1219 |
+
"""
|
1220 |
+
<style>
|
1221 |
+
.custom-text1 {
|
1222 |
+
font-size: 36px; /* Adjust font size */
|
1223 |
+
color:#6bbf6b ; /* Adjust text color */
|
1224 |
+
}
|
1225 |
+
</style>
|
1226 |
+
""",
|
1227 |
+
unsafe_allow_html=True
|
1228 |
+
)
|
1229 |
+
else:
|
1230 |
+
st.markdown(
|
1231 |
+
"""
|
1232 |
+
<style>
|
1233 |
+
.custom-text1 {
|
1234 |
+
font-size: 36px; /* Adjust font size */
|
1235 |
+
color: #ff6868; /* Adjust text color */
|
1236 |
+
}
|
1237 |
+
</style>
|
1238 |
+
""",
|
1239 |
+
unsafe_allow_html=True
|
1240 |
+
)
|
1241 |
+
|
1242 |
+
# Apply custom styles to text
|
1243 |
+
st.markdown(f'<p class="custom-text1">{"$ "+numerize(ef2-ef1,0)}</p>', unsafe_allow_html=True)
|
1244 |
+
# st.markdown(f'<p style="color: red;">{st.metric(label="", value=header_df["Prospects"]["Change"])}</p>', unsafe_allow_html=True)
|
1245 |
+
# st.markdown(f'<p style="color: red;">{header_df["Prospects"]["Change"]}</p>', unsafe_allow_html=True)
|
1246 |
+
|
1247 |
+
with _columns[4]:
|
1248 |
+
st.markdown(f'<p></hr></p>', unsafe_allow_html=True)
|
1249 |
+
# Apply custom styles to text
|
1250 |
+
st.markdown(f'<p class="custom-text1">{round((ef2-ef1)/ef1*100,2)}%</p>', unsafe_allow_html=True)
|
1251 |
+
st.markdown(
|
1252 |
+
"""<hr class="spends-child-seperator">""",
|
1253 |
+
unsafe_allow_html=True,
|
1254 |
+
)
|
1255 |
+
|
1256 |
# st.markdown("""<hr class="spends-heading-seperator">""", unsafe_allow_html=True)
|
1257 |
|
1258 |
# header_df.reset_index(inplace=True)
|
|
|
1351 |
# )
|
1352 |
|
1353 |
with st.expander("Channel Spends Simulator", expanded=True):
|
1354 |
+
_columns1 = st.columns((2, 2, 1,1))
|
1355 |
with _columns1[0]:
|
1356 |
optimization_selection = st.selectbox(
|
1357 |
"Optimize", options=["Media Spends", target], key="optimization_key"
|
1358 |
)
|
1359 |
|
1360 |
with _columns1[1]:
|
1361 |
+
# st.markdown("#")
|
1362 |
# if st.checkbox(
|
1363 |
# label="Optimize all Channels",
|
1364 |
# key="optimze_all_channels",
|
|
|
1375 |
)
|
1376 |
|
1377 |
with _columns1[2]:
|
|
|
1378 |
# st.button(
|
1379 |
# "Optimize",
|
1380 |
# on_click=optimize,
|
|
|
1385 |
optimize_placeholder = st.empty()
|
1386 |
|
1387 |
with _columns1[3]:
|
1388 |
+
# st.markdown("#")
|
1389 |
st.button(
|
1390 |
"Reset",
|
1391 |
on_click=reset_scenario,
|
|
|
1395 |
# st.write(target)
|
1396 |
|
1397 |
|
1398 |
+
_columns2 = st.columns((2, 2, 2,2))
|
1399 |
if st.session_state["optimization_key"] == "Media Spends":
|
1400 |
with _columns2[0]:
|
1401 |
spend_input = st.text_input(
|
|
|
1449 |
on_change=update_sales,
|
1450 |
)
|
1451 |
with _columns2[2]:
|
1452 |
+
st.text_input(
|
1453 |
+
"Overall Lower Bound"
|
1454 |
+
)
|
1455 |
+
with _columns2[3]:
|
1456 |
+
st.text_input(
|
1457 |
+
"Overall Upper Bound"
|
1458 |
+
)
|
1459 |
+
|
1460 |
min_value = round(_scenario.actual_total_sales * 0.5)
|
1461 |
max_value = round(_scenario.actual_total_sales * 1.5)
|
1462 |
# st.write(min_value)
|
|
|
1468 |
for value in range(min_value, max_value + 1, int(100))
|
1469 |
]
|
1470 |
|
1471 |
+
# st.select_slider(
|
1472 |
+
# "Absolute Slider",
|
1473 |
+
# options=st.session_state["total_sales_change_abs_slider_options"],
|
1474 |
+
# key="total_sales_change_abs_slider",
|
1475 |
+
# on_change=update_sales_abs_slider,
|
1476 |
+
# # value=numerize(min_value, 1)
|
1477 |
+
# )
|
1478 |
|
1479 |
if (
|
1480 |
not st.session_state["allow_sales_update"]
|
summary_df.pkl
CHANGED
@@ -1,3 +1,3 @@
|
|
1 |
version https://git-lfs.github.com/spec/v1
|
2 |
-
oid sha256:
|
3 |
size 1822
|
|
|
1 |
version https://git-lfs.github.com/spec/v1
|
2 |
+
oid sha256:b1c5355ea93c754c8f7eee9dca0242123d67190ebe0468dec482dc4931a4449b
|
3 |
size 1822
|