attila-balint-kul's picture
Upload 4 files
dae6339 verified
import streamlit as st
import utils
from components import (
buildings_view,
computation_view,
header,
logos,
model_selector,
models_view,
overview_view,
accuracy_view,
relative_performance_view,
links,
)
USE_CASE = st.secrets["enfobench_usecase"]
PAGES = [
"Overview",
"Buildings",
"Models",
"Accuracy",
"Relative Performance",
"Computational Resources",
]
st.set_page_config(page_title=f"{USE_CASE} Dashboard", layout="wide")
@st.cache_data(ttl=86400)
def fetch_data():
return utils.get_wandb_data(
entity=st.secrets["wandb_entity"],
project=st.secrets["wandb_project"],
api_key=st.secrets["wandb_api_key"],
job_type="metrics",
)
# Load data
data = fetch_data()
# Extract models
models = sorted(data["model"].unique().tolist())
with st.sidebar:
logos()
view = st.selectbox("View", PAGES, index=0)
if view in ["Accuracy", "Relative Performance", "Computational Resources"]:
models_to_plot = model_selector(models, data)
if view == "Overview":
links(current=USE_CASE)
st.header("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(f"EnFoBench - {USE_CASE}")
if view == "Overview":
overview_view(data)
elif view == "Buildings":
buildings_view(data)
elif view == "Models":
models_view(data)
elif view == "Accuracy":
accuracy_view(data, models_to_plot)
elif view == "Relative Performance":
relative_performance_view(data, models_to_plot)
elif view == "Computational Resources":
computation_view(data, models_to_plot)
else:
st.write("Not implemented yet")