attila-balint-kul commited on
Commit
727155a
·
verified ·
1 Parent(s): c7d65bc

Upload components.py

Browse files
Files changed (1) hide show
  1. components.py +5 -5
components.py CHANGED
@@ -73,7 +73,7 @@ def model_selector(models: list[str], data: pd.DataFrame) -> set[str]:
73
  # Group models by their prefix
74
  model_groups: dict[str, list[str]] = {}
75
  for model in models:
76
- group, model_name = model.split(".", maxsplit=1)
77
  if group not in model_groups:
78
  model_groups[group] = []
79
  model_groups[group].append(model_name)
@@ -126,10 +126,10 @@ def model_selector(models: list[str], data: pd.DataFrame) -> set[str]:
126
  st.text(model_group)
127
  for model_name in models:
128
  to_plot = st.checkbox(
129
- model_name, value=True, key=f"{model_group}.{model_name}"
130
  )
131
  if to_plot:
132
- models_to_plot.add(f"{model_group}.{model_name}")
133
  return models_to_plot
134
 
135
 
@@ -353,7 +353,7 @@ def models_view(data: pd.DataFrame):
353
  with right:
354
  st.markdown("#### Frameworks")
355
  _df = models.copy()
356
- _df["Framework"] = _df.index.str.split(".").str[0]
357
  fig = px.pie(
358
  _df.groupby("Framework").size().reset_index(),
359
  values=0,
@@ -614,6 +614,6 @@ def computation_view(data: pd.DataFrame, models_to_plot: set[str]):
614
  styler.map(lambda x: "text-align: center; font-size: 14px;")
615
  return styler
616
 
617
- st.markdown(f"#### Computational time per building")
618
  styled_table = cpu_per_building_table.style.pipe(custom_table)
619
  st.dataframe(styled_table, use_container_width=True)
 
73
  # Group models by their prefix
74
  model_groups: dict[str, list[str]] = {}
75
  for model in models:
76
+ group, model_name = model.split("-", maxsplit=1)
77
  if group not in model_groups:
78
  model_groups[group] = []
79
  model_groups[group].append(model_name)
 
126
  st.text(model_group)
127
  for model_name in models:
128
  to_plot = st.checkbox(
129
+ model_name, value=True, key=f"{model_group}-{model_name}"
130
  )
131
  if to_plot:
132
+ models_to_plot.add(f"{model_group}-{model_name}")
133
  return models_to_plot
134
 
135
 
 
353
  with right:
354
  st.markdown("#### Frameworks")
355
  _df = models.copy()
356
+ _df["Framework"] = _df.index.str.split("-").str[0]
357
  fig = px.pie(
358
  _df.groupby("Framework").size().reset_index(),
359
  values=0,
 
614
  styler.map(lambda x: "text-align: center; font-size: 14px;")
615
  return styler
616
 
617
+ st.markdown("#### Computational time per building")
618
  styled_table = cpu_per_building_table.style.pipe(custom_table)
619
  st.dataframe(styled_table, use_container_width=True)