3v324v23 commited on
Commit
439b9b7
·
1 Parent(s): c3d6e37

tryout no plot

Browse files
Files changed (1) hide show
  1. streamlit_simulation/app.py +32 -32
streamlit_simulation/app.py CHANGED
@@ -242,7 +242,7 @@ def render_simulation_view(timestamp, prediction, actual, progress, fig, paused=
242
  f"{title}</div>",
243
  unsafe_allow_html=True
244
  )
245
- #plot_container.pyplot(fig)
246
 
247
  st.markdown("<div style='margin-bottom: 0.5rem;'></div>", unsafe_allow_html=True)
248
  x_axis_label.markdown(
@@ -251,37 +251,37 @@ def render_simulation_view(timestamp, prediction, actual, progress, fig, paused=
251
  unsafe_allow_html=True
252
  )
253
 
254
- #with info_container.container():
255
- # st.markdown("<div style='margin-top: 5rem;'></div>", unsafe_allow_html=True)
256
- # st.markdown(
257
- # f"<span style='font-size: 24px; font-weight: 600; color: {HEADER_COLOR} !important;'>Time: {timestamp}</span>",
258
- # unsafe_allow_html=True
259
- # )
260
- #
261
- # st.metric("Prediction", f"{prediction:,.0f} MW" if prediction is not None else "–")
262
- # st.metric("Actual", f"{actual:,.0f} MW" if actual is not None else "–")
263
- # #st.caption("Simulation Progress")
264
- # #st.progress(progress)
265
- #
266
- # if len(st.session_state.true_vals) > 1:
267
- # true_arr = np.array(st.session_state.true_vals)
268
- # pred_arr = np.array(st.session_state.pred_vals[:-1])
269
- #
270
- # min_len = min(len(true_arr), len(pred_arr)) #just start if there are 2 actual values
271
- # if min_len >= 1:
272
- # errors = np.abs(true_arr[:min_len] - pred_arr[:min_len])
273
- # mape = np.mean(errors / np.where(true_arr[:min_len] == 0, 1e-10, true_arr[:min_len])) * 100
274
- # mae = np.mean(errors)
275
- # max_error = np.max(errors)
276
- #
277
- # st.divider()
278
- # st.markdown(
279
- # f"<span style='font-size: 24px; font-weight: 600; color: {HEADER_COLOR} !important;'>Interim Metrics</span>",
280
- # unsafe_allow_html=True
281
- # )
282
- # st.metric("MAPE (so far)", f"{mape:.2f} %")
283
- # st.metric("MAE (so far)", f"{mae:,.0f} MW")
284
- # st.metric("Max Error", f"{max_error:,.0f} MW")
285
 
286
 
287
 
 
242
  f"{title}</div>",
243
  unsafe_allow_html=True
244
  )
245
+ plot_container.pyplot(fig)
246
 
247
  st.markdown("<div style='margin-bottom: 0.5rem;'></div>", unsafe_allow_html=True)
248
  x_axis_label.markdown(
 
251
  unsafe_allow_html=True
252
  )
253
 
254
+ with info_container.container():
255
+ st.markdown("<div style='margin-top: 5rem;'></div>", unsafe_allow_html=True)
256
+ st.markdown(
257
+ f"<span style='font-size: 24px; font-weight: 600; color: {HEADER_COLOR} !important;'>Time: {timestamp}</span>",
258
+ unsafe_allow_html=True
259
+ )
260
+
261
+ st.metric("Prediction", f"{prediction:,.0f} MW" if prediction is not None else "–")
262
+ st.metric("Actual", f"{actual:,.0f} MW" if actual is not None else "–")
263
+ st.caption("Simulation Progress")
264
+ st.progress(progress)
265
+
266
+ if len(st.session_state.true_vals) > 1:
267
+ true_arr = np.array(st.session_state.true_vals)
268
+ pred_arr = np.array(st.session_state.pred_vals[:-1])
269
+
270
+ min_len = min(len(true_arr), len(pred_arr)) #just start if there are 2 actual values
271
+ if min_len >= 1:
272
+ errors = np.abs(true_arr[:min_len] - pred_arr[:min_len])
273
+ mape = np.mean(errors / np.where(true_arr[:min_len] == 0, 1e-10, true_arr[:min_len])) * 100
274
+ mae = np.mean(errors)
275
+ max_error = np.max(errors)
276
+
277
+ st.divider()
278
+ st.markdown(
279
+ f"<span style='font-size: 24px; font-weight: 600; color: {HEADER_COLOR} !important;'>Interim Metrics</span>",
280
+ unsafe_allow_html=True
281
+ )
282
+ st.metric("MAPE (so far)", f"{mape:.2f} %")
283
+ st.metric("MAE (so far)", f"{mae:,.0f} MW")
284
+ st.metric("Max Error", f"{max_error:,.0f} MW")
285
 
286
 
287