|
import streamlit as st |
|
|
|
from components import summary_view |
|
import utils |
|
|
|
wandb_api_key = st.secrets["wandb"] |
|
|
|
st.set_page_config(page_title='Electricity Demand Dashboard', layout='wide') |
|
|
|
|
|
@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", ["Summary", "Raw Data"], 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}") |
|
|
|
if view == "Summary": |
|
summary_view(data, models_to_plot) |
|
|