albertvillanova HF staff commited on
Commit
0a4c821
1 Parent(s): 8e404a5

Fix overflow in Details

Browse files
Files changed (1) hide show
  1. src/details.py +2 -0
src/details.py CHANGED
@@ -54,6 +54,8 @@ def display_details(sample_idx, *dfs):
54
  return
55
  # Pop model_name and add it to the column name
56
  df = pd.concat([row.rename(row.pop("model_name")) for row in rows], axis="columns")
 
 
57
  return (
58
  df.style
59
  .format(na_rep="")
 
54
  return
55
  # Pop model_name and add it to the column name
56
  df = pd.concat([row.rename(row.pop("model_name")) for row in rows], axis="columns")
57
+ # Wrap long strings to avoid overflow; e.g. URLs in "doc.Websites visited_NEV_2"
58
+ df = df.apply(lambda x: x.str.wrap(140) if x.dtype == "object" else x)
59
  return (
60
  df.style
61
  .format(na_rep="")