albertvillanova HF staff commited on
Commit
45f2d12
1 Parent(s): c8b695a

Make display_details robust

Browse files
Files changed (1) hide show
  1. app.py +1 -3
app.py CHANGED
@@ -202,9 +202,7 @@ def display_details(df_1, df_2, sample_idx):
202
  s_1 = df_1.iloc[sample_idx]
203
  s_2 = df_2.iloc[sample_idx]
204
  # Pop model_name and add it to the column name
205
- s_1 = s_1.rename(s_1.pop("model_name"))
206
- s_2 = s_2.rename(s_2.pop("model_name"))
207
- df = pd.concat([s_1, s_2], axis="columns")#.rename_axis("Parameters").reset_index()
208
  return (
209
  df.style
210
  .format(na_rep="")
 
202
  s_1 = df_1.iloc[sample_idx]
203
  s_2 = df_2.iloc[sample_idx]
204
  # Pop model_name and add it to the column name
205
+ df = pd.concat([s.rename(s.pop("model_name")) for s in [s_1, s_2] if "model_name" in s], axis="columns")
 
 
206
  return (
207
  df.style
208
  .format(na_rep="")