Spaces:
Sleeping
Sleeping
[UX] tab4_optimization.py: British spelling (Optimization -> Optimisation)
Browse files
tabs/tab4_optimization.py
CHANGED
|
@@ -254,7 +254,7 @@ def panel_load_from_json_or_csv():
|
|
| 254 |
|
| 255 |
if "scenario_loaded_file" in st.session_state:
|
| 256 |
st.success(
|
| 257 |
-
f"Scenario **{st.session_state['scenario_loaded_file']}** loaded :\n\nAll tabs updated -
|
| 258 |
icon="✅"
|
| 259 |
)
|
| 260 |
uploaded_json = st.file_uploader(
|
|
@@ -510,7 +510,7 @@ def run_and_store_result():
|
|
| 510 |
)
|
| 511 |
|
| 512 |
if not success:
|
| 513 |
-
st.error("❌
|
| 514 |
if "message" in result:
|
| 515 |
st.error(result["message"])
|
| 516 |
return
|
|
@@ -526,7 +526,7 @@ def run_and_store_result():
|
|
| 526 |
total_removed = result["total_removed"]
|
| 527 |
|
| 528 |
if total_removed <= 0:
|
| 529 |
-
st.warning(f"❌
|
| 530 |
return
|
| 531 |
|
| 532 |
total_cost = sum(
|
|
@@ -1330,7 +1330,7 @@ def render_tab():
|
|
| 1330 |
st.markdown(
|
| 1331 |
"""
|
| 1332 |
<div class="text_with_border">
|
| 1333 |
-
<p>Run the
|
| 1334 |
</div>
|
| 1335 |
""",
|
| 1336 |
unsafe_allow_html=True
|
|
@@ -1355,7 +1355,7 @@ def render_tab():
|
|
| 1355 |
|
| 1356 |
with tab_run:
|
| 1357 |
st.markdown("""
|
| 1358 |
-
<p class="crra-sub-heading">Run
|
| 1359 |
unsafe_allow_html=True,
|
| 1360 |
)
|
| 1361 |
col_inputs, col_scenario = st.columns(2, gap="large")
|
|
@@ -1365,7 +1365,7 @@ def render_tab():
|
|
| 1365 |
<p class="crra-sub-sub-heading">From inputs</p>""",
|
| 1366 |
unsafe_allow_html=True,
|
| 1367 |
)
|
| 1368 |
-
run_clicked = st.button("Run
|
| 1369 |
run_msg_area = st.container()
|
| 1370 |
panel_run_from_tabs()
|
| 1371 |
panel_load_from_excel()
|
|
@@ -1381,7 +1381,7 @@ def render_tab():
|
|
| 1381 |
with run_msg_area:
|
| 1382 |
run_and_store_result()
|
| 1383 |
|
| 1384 |
-
no_results = '<p class="caption">Run the
|
| 1385 |
|
| 1386 |
latest = st.session_state.get("latest_result")
|
| 1387 |
if not latest:
|
|
@@ -1415,7 +1415,7 @@ def render_tab():
|
|
| 1415 |
|
| 1416 |
with tab_results:
|
| 1417 |
show_metrics(latest)
|
| 1418 |
-
st.markdown('<p class="crra-sub-heading">
|
| 1419 |
st.dataframe(df_display, width='stretch')
|
| 1420 |
st.markdown('<p class="crra-sub-heading">Method allocation breakdown</p>', unsafe_allow_html=True)
|
| 1421 |
st.markdown(
|
|
|
|
| 254 |
|
| 255 |
if "scenario_loaded_file" in st.session_state:
|
| 256 |
st.success(
|
| 257 |
+
f"Scenario **{st.session_state['scenario_loaded_file']}** loaded :\n\nAll tabs updated - Optimisation results displayed.",
|
| 258 |
icon="✅"
|
| 259 |
)
|
| 260 |
uploaded_json = st.file_uploader(
|
|
|
|
| 510 |
)
|
| 511 |
|
| 512 |
if not success:
|
| 513 |
+
st.error("❌ Optimisation failed")
|
| 514 |
if "message" in result:
|
| 515 |
st.error(result["message"])
|
| 516 |
return
|
|
|
|
| 526 |
total_removed = result["total_removed"]
|
| 527 |
|
| 528 |
if total_removed <= 0:
|
| 529 |
+
st.warning(f"❌ Optimisation removed 0 {CO2_UNIT}. Relax constraints or increase resources.", icon=":material/warning:")
|
| 530 |
return
|
| 531 |
|
| 532 |
total_cost = sum(
|
|
|
|
| 1330 |
st.markdown(
|
| 1331 |
"""
|
| 1332 |
<div class="text_with_border">
|
| 1333 |
+
<p>Run the optimisation tool, explore results and save scenarios for comparison or export.</p>
|
| 1334 |
</div>
|
| 1335 |
""",
|
| 1336 |
unsafe_allow_html=True
|
|
|
|
| 1355 |
|
| 1356 |
with tab_run:
|
| 1357 |
st.markdown("""
|
| 1358 |
+
<p class="crra-sub-heading">Run optimisation</p>""",
|
| 1359 |
unsafe_allow_html=True,
|
| 1360 |
)
|
| 1361 |
col_inputs, col_scenario = st.columns(2, gap="large")
|
|
|
|
| 1365 |
<p class="crra-sub-sub-heading">From inputs</p>""",
|
| 1366 |
unsafe_allow_html=True,
|
| 1367 |
)
|
| 1368 |
+
run_clicked = st.button("Run Optimisation", icon=":material/play_arrow:", key="btn-run-optimization", type="primary")
|
| 1369 |
run_msg_area = st.container()
|
| 1370 |
panel_run_from_tabs()
|
| 1371 |
panel_load_from_excel()
|
|
|
|
| 1381 |
with run_msg_area:
|
| 1382 |
run_and_store_result()
|
| 1383 |
|
| 1384 |
+
no_results = '<p class="caption">Run the optimisation first to see results here.</p>'
|
| 1385 |
|
| 1386 |
latest = st.session_state.get("latest_result")
|
| 1387 |
if not latest:
|
|
|
|
| 1415 |
|
| 1416 |
with tab_results:
|
| 1417 |
show_metrics(latest)
|
| 1418 |
+
st.markdown('<p class="crra-sub-heading">Optimisation Summary</p>', unsafe_allow_html=True)
|
| 1419 |
st.dataframe(df_display, width='stretch')
|
| 1420 |
st.markdown('<p class="crra-sub-heading">Method allocation breakdown</p>', unsafe_allow_html=True)
|
| 1421 |
st.markdown(
|