|
import streamlit as st |
|
|
|
from components import ( |
|
buildings_view, |
|
models_view, |
|
performance_view, |
|
computation_view, |
|
logos, |
|
model_selector, |
|
header, |
|
) |
|
import utils |
|
|
|
PAGES = [ |
|
"Buildings", |
|
"Models", |
|
"Performance", |
|
"Computational Resources", |
|
] |
|
|
|
|
|
st.set_page_config(page_title="Electricity Demand Dashboard", layout="wide") |
|
|
|
|
|
@st.cache_data(ttl=86400) |
|
def fetch_data(): |
|
return utils.get_wandb_data( |
|
entity=st.secrets["wandb_entity"], |
|
project="enfobench-electricity-demand", |
|
api_key=st.secrets["wandb_api_key"], |
|
job_type="metrics", |
|
) |
|
|
|
|
|
|
|
data = fetch_data() |
|
|
|
|
|
models = sorted(data["model"].unique().tolist()) |
|
|
|
|
|
with st.sidebar: |
|
logos() |
|
view = st.selectbox("View", PAGES, index=0) |
|
models_to_plot = model_selector(models) |
|
st.subheader("Refresh data") |
|
refresh = st.button( |
|
"Refresh", use_container_width=True, help="Fetch the latest data from W&B" |
|
) |
|
if refresh: |
|
fetch_data.clear() |
|
st.rerun() |
|
|
|
|
|
header() |
|
|
|
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") |
|
|