dlaj commited on
Commit
5ac9293
·
verified ·
1 Parent(s): 0b45268

Update streamlit_simulation/app.py

Browse files
Files changed (1) hide show
  1. streamlit_simulation/app.py +20 -3
streamlit_simulation/app.py CHANGED
@@ -242,13 +242,30 @@ def render_simulation_view(timestamp, prediction, actual, progress, fig, paused=
242
  unsafe_allow_html=True
243
  )
244
 
245
- with info_container:
246
- st.markdown("---")
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
247
  st.markdown(
248
  f"<span style='font-size: 24px; font-weight: 600; color: {HEADER_COLOR} !important;'>Time: {timestamp}</span>",
249
  unsafe_allow_html=True
250
  )
251
-
252
  st.metric("Prediction", f"{prediction:,.0f} MW" if prediction is not None else "–")
253
  st.metric("Actual", f"{actual:,.0f} MW" if actual is not None else "–")
254
  st.caption("Simulation Progress")
 
242
  unsafe_allow_html=True
243
  )
244
 
245
+ def render_simulation_view(timestamp, prediction, actual, progress, fig, paused=False):
246
+ """Displays the simulation plot and metrics in the UI."""
247
+ title = "Actual vs. Prediction (Paused)" if paused else "Actual vs. Prediction"
248
+ plot_title.markdown(
249
+ f"<div style='text-align: center; font-size: 20pt; font-weight: bold; color: {TEXT_COLOR}; margin-bottom: -0.7rem; margin-top: 0rem;'>"
250
+ f"{title}</div>",
251
+ unsafe_allow_html=True
252
+ )
253
+ plot_container.pyplot(fig)
254
+
255
+ st.markdown("<div style='margin-bottom: 0.5rem;'></div>", unsafe_allow_html=True)
256
+ x_axis_label.markdown(
257
+ f"<div style='text-align: center; font-size: 14pt; color: {TEXT_COLOR}; margin-top: -0.5rem;'>"
258
+ f"Time</div>",
259
+ unsafe_allow_html=True
260
+ )
261
+
262
+ with info_container.container():
263
+ st.markdown("<div style='margin-top: 5rem;'></div>", unsafe_allow_html=True)
264
  st.markdown(
265
  f"<span style='font-size: 24px; font-weight: 600; color: {HEADER_COLOR} !important;'>Time: {timestamp}</span>",
266
  unsafe_allow_html=True
267
  )
268
+
269
  st.metric("Prediction", f"{prediction:,.0f} MW" if prediction is not None else "–")
270
  st.metric("Actual", f"{actual:,.0f} MW" if actual is not None else "–")
271
  st.caption("Simulation Progress")