File size: 2,254 Bytes
f1e08ee 60bd8ab f1e08ee c4ae75a f1e08ee f87d2ee 60bd8ab f87d2ee f1e08ee c4ae75a f1e08ee c4ae75a f1e08ee c4ae75a f1e08ee c4ae75a f1e08ee f87d2ee f1e08ee f87d2ee f1e08ee 60bd8ab f1e08ee 60bd8ab f1e08ee f87d2ee 60bd8ab f87d2ee |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 |
import streamlit as st
from components import buildings_view, models_view, performance_view, computation_view
import utils
st.set_page_config(page_title="Electricity Demand Dashboard", layout="wide")
PAGES = [
"Buildings",
"Models",
"Performance",
"Computational Resources",
]
@st.cache_data(ttl=86400)
def fetch_data():
return utils.get_wandb_data(
st.secrets["wandb_entity"],
"enfobench-electricity-demand",
st.secrets["wandb_api_key"],
job_type="metrics",
)
data = fetch_data()
models = sorted(data["model"].unique().tolist())
models_to_plot = set()
model_groups: dict[str, list[str]] = {}
for model in models:
group, model_name = model.split(".", maxsplit=1)
if group not in model_groups:
model_groups[group] = []
model_groups[group].append(model_name)
with st.sidebar:
left, right = st.columns(
2
) # Create two columns within the right column for side-by-side images
with left:
st.image("./images/ku_leuven_logo.png")
with right:
st.image("./images/energyville_logo.png")
view = st.selectbox("View", PAGES, index=0)
st.header("Models to include")
left, right = st.columns(2)
with left:
select_none = st.button("Select None", use_container_width=True)
if select_none:
for model in models:
st.session_state[model] = False
with right:
select_all = st.button("Select All", use_container_width=True)
if select_all:
for model in models:
st.session_state[model] = True
for model_group, models in model_groups.items():
st.text(model_group)
for model_name in models:
to_plot = st.checkbox(model_name, value=True, key=f"{model_group}.{model_name}")
if to_plot:
models_to_plot.add(f"{model_group}.{model_name}")
st.title("EnFoBench - Electricity Demand")
st.divider()
if view == "Buildings":
buildings_view(data)
elif view == "Models":
models_view(data)
elif view == "Performance":
performance_view(data, models_to_plot)
elif view == "Computational Resources":
computation_view(data, models_to_plot)
else:
st.write("Not implemented yet")
|