|
import streamlit as st |
|
|
|
from components import buildings_view, models_view, performance_view |
|
import utils |
|
|
|
st.set_page_config(page_title="Electricity Demand Dashboard", layout="wide") |
|
|
|
PAGES = [ |
|
"Buildings", |
|
"Models", |
|
"Performance", |
|
] |
|
|
|
|
|
@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 |
|
) |
|
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") |
|
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) |
|
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) |
|
else: |
|
st.write("Not implemented yet") |
|
|