ror HF Staff commited on
Commit
61506bd
·
1 Parent(s): 64fcb68

3 colmuns summary

Browse files
Files changed (1) hide show
  1. summary_page.py +62 -36
summary_page.py CHANGED
@@ -13,7 +13,18 @@ def create_summary_page(df: pd.DataFrame, available_models: list[str]) -> plt.Fi
13
  ax.axis('off')
14
  return fig
15
 
16
- fig, ax = plt.subplots(figsize=(16, len(available_models) * 2.5 + 2), facecolor='#000000')
 
 
 
 
 
 
 
 
 
 
 
17
  ax.set_facecolor('#000000')
18
 
19
  colors = {
@@ -27,6 +38,11 @@ def create_summary_page(df: pd.DataFrame, available_models: list[str]) -> plt.Fi
27
  visible_model_count = 0
28
  max_y = 0
29
 
 
 
 
 
 
30
  for i, model_name in enumerate(available_models):
31
  if model_name not in df.index:
32
  continue
@@ -62,64 +78,74 @@ def create_summary_page(df: pd.DataFrame, available_models: list[str]) -> plt.Fi
62
  if amd_total == 0 and nvidia_total == 0:
63
  continue
64
 
65
- # Position for this model - use visible model count for spacing
66
- y_base = (2.2 + visible_model_count) * 1.8
 
 
 
 
 
 
 
 
 
67
  y_model_name = y_base # Model name above AMD bar
68
- y_amd_bar = y_base + 0.45 # AMD bar
69
- y_nvidia_bar = y_base + 0.97 # NVIDIA bar
70
- max_y = max(max_y, y_nvidia_bar + 0.5)
71
 
72
- # Model name centered above the AMD bar
73
- left_0 = 8
74
- bar_length = 92
75
- ax.text(bar_length / 2 + left_0, y_model_name, f"{i} - {y_model_name} - {model_name.lower()}",
76
  ha='center', va='center', color='#FFFFFF',
77
- fontsize=20, fontfamily='monospace', fontweight='bold')
 
 
 
 
 
78
 
79
- # AMD label and bar on the same level
80
- ax.text(left_0 - 2, y_amd_bar, "amd", ha='right', va='center', color='#CCCCCC', fontsize=18, fontfamily='monospace', fontweight='normal')
81
  if amd_total > 0:
82
- # AMD bar starts after labels
83
- left = left_0
84
  for category in ['passed', 'failed', 'skipped', 'error']:
85
  if amd_stats[category] > 0:
86
- width = amd_stats[category] / amd_total * bar_length
87
- ax.barh(y_amd_bar, width, left=left, height=0.405,
88
  color=colors[category], alpha=0.9)
89
- if width > 4:
90
- ax.text(left + width/2, y_amd_bar, str(amd_stats[category]),
91
- ha='center', va='center', color='black',
92
- fontweight='bold', fontsize=12, fontfamily='monospace')
93
  left += width
94
  else:
95
- ax.barh(y_amd_bar, bar_length, left=left_0, height=0.405, color=colors['empty'], alpha=0.9)
96
- ax.text(left_0 + bar_length/2, y_amd_bar, "No data", ha='center', va='center', color='black', fontweight='bold', fontsize=12, fontfamily='monospace')
97
 
98
- # NVIDIA label and bar on the same level
99
- ax.text(left_0 - 2, y_nvidia_bar, "nvidia", ha='right', va='center', color='#CCCCCC', fontsize=18, fontfamily='monospace', fontweight='normal')
100
 
101
  if nvidia_total > 0:
102
- # NVIDIA bar starts after labels
103
- left = left_0
104
  for category in ['passed', 'failed', 'skipped', 'error']:
105
  if nvidia_stats[category] > 0:
106
- width = nvidia_stats[category] / nvidia_total * bar_length
107
- ax.barh(y_nvidia_bar, width, left=left, height=0.405,
108
  color=colors[category], alpha=0.9)
109
- if width > 4:
110
- ax.text(left + width/2, y_nvidia_bar, str(nvidia_stats[category]),
111
- ha='center', va='center', color='black',
112
- fontweight='bold', fontsize=12, fontfamily='monospace')
113
  left += width
114
  else:
115
- ax.barh(y_nvidia_bar, bar_length, left=left_0, height=0.405, color=colors['empty'], alpha=0.9)
116
- ax.text(left_0 + bar_length/2, y_nvidia_bar, "No data", ha='center', va='center', color='black', fontweight='bold', fontsize=12, fontfamily='monospace')
117
 
118
  # Increment counter for next visible model
119
  visible_model_count += 1
120
 
121
  # Style the axes to be completely invisible and span full width
122
- ax.set_xlim(0, 100)
123
  ax.set_ylim(0, max_y)
124
  ax.set_xlabel('')
125
  ax.set_ylabel('')
 
13
  ax.axis('off')
14
  return fig
15
 
16
+ # Calculate dimensions for N-column layout
17
+ model_count = len(available_models)
18
+ columns = 3
19
+ rows = (model_count + columns - 1) // columns # Ceiling division
20
+
21
+ # Figure dimensions - wider for 4 columns, height based on rows
22
+ figure_width = 20 # Wider to accommodate 4 columns
23
+ max_height = 12 # Maximum height in inches
24
+ height_per_row = min(2.2, max_height / max(rows, 1))
25
+ figure_height = min(max_height, rows * height_per_row + 2)
26
+
27
+ fig, ax = plt.subplots(figsize=(figure_width, figure_height), facecolor='#000000')
28
  ax.set_facecolor('#000000')
29
 
30
  colors = {
 
38
  visible_model_count = 0
39
  max_y = 0
40
 
41
+ # Column layout parameters
42
+ column_width = 100 / columns # Each column takes 25% of width
43
+ bar_width = column_width * 0.8 # 80% of column width for bars
44
+ bar_margin = column_width * 0.1 # 10% margin on each side
45
+
46
  for i, model_name in enumerate(available_models):
47
  if model_name not in df.index:
48
  continue
 
78
  if amd_total == 0 and nvidia_total == 0:
79
  continue
80
 
81
+ # Calculate position in 4-column grid
82
+ col = visible_model_count % columns
83
+ row = visible_model_count // columns
84
+
85
+ # Calculate horizontal position for this column
86
+ col_left = col * column_width + bar_margin
87
+ col_center = col * column_width + column_width / 2
88
+
89
+ # Calculate vertical position for this row
90
+ vertical_spacing = height_per_row
91
+ y_base = (1.5 + row) * vertical_spacing
92
  y_model_name = y_base # Model name above AMD bar
93
+ y_amd_bar = y_base + vertical_spacing * 0.25 # AMD bar
94
+ y_nvidia_bar = y_base + vertical_spacing * 0.54 # NVIDIA bar
95
+ max_y = max(max_y, y_nvidia_bar + vertical_spacing * 0.3)
96
 
97
+ # Model name centered above the bars in this column
98
+ ax.text(col_center, y_model_name, model_name.lower(),
 
 
99
  ha='center', va='center', color='#FFFFFF',
100
+ fontsize=16, fontfamily='monospace', fontweight='bold')
101
+
102
+ # AMD label and bar in this column
103
+ bar_height = min(0.4, vertical_spacing * 0.22) # Adjust bar height based on spacing
104
+ label_x = col_left - 1 # Label position to the left of the bar
105
+ ax.text(label_x, y_amd_bar, "amd", ha='right', va='center', color='#CCCCCC', fontsize=14, fontfamily='monospace', fontweight='normal')
106
 
 
 
107
  if amd_total > 0:
108
+ # AMD bar starts at column left position
109
+ left = col_left
110
  for category in ['passed', 'failed', 'skipped', 'error']:
111
  if amd_stats[category] > 0:
112
+ width = amd_stats[category] / amd_total * bar_width
113
+ ax.barh(y_amd_bar, width, left=left, height=bar_height,
114
  color=colors[category], alpha=0.9)
115
+ # if width > 2: # Smaller threshold for text display
116
+ # ax.text(left + width/2, y_amd_bar, str(amd_stats[category]),
117
+ # ha='center', va='center', color='black',
118
+ # fontweight='bold', fontsize=10, fontfamily='monospace')
119
  left += width
120
  else:
121
+ ax.barh(y_amd_bar, bar_width, left=col_left, height=bar_height, color=colors['empty'], alpha=0.9)
122
+ # ax.text(col_center, y_amd_bar, "No data", ha='center', va='center', color='black', fontweight='bold', fontsize=10, fontfamily='monospace')
123
 
124
+ # NVIDIA label and bar in this column
125
+ ax.text(label_x, y_nvidia_bar, "nvidia", ha='right', va='center', color='#CCCCCC', fontsize=14, fontfamily='monospace', fontweight='normal')
126
 
127
  if nvidia_total > 0:
128
+ # NVIDIA bar starts at column left position
129
+ left = col_left
130
  for category in ['passed', 'failed', 'skipped', 'error']:
131
  if nvidia_stats[category] > 0:
132
+ width = nvidia_stats[category] / nvidia_total * bar_width
133
+ ax.barh(y_nvidia_bar, width, left=left, height=bar_height,
134
  color=colors[category], alpha=0.9)
135
+ # if width > 2: # Smaller threshold for text display
136
+ # ax.text(left + width/2, y_nvidia_bar, str(nvidia_stats[category]),
137
+ # ha='center', va='center', color='black',
138
+ # fontweight='bold', fontsize=10, fontfamily='monospace')
139
  left += width
140
  else:
141
+ ax.barh(y_nvidia_bar, bar_width, left=col_left, height=bar_height, color=colors['empty'], alpha=0.9)
142
+ # ax.text(col_center, y_nvidia_bar, "No data", ha='center', va='center', color='black', fontweight='bold', fontsize=10, fontfamily='monospace')
143
 
144
  # Increment counter for next visible model
145
  visible_model_count += 1
146
 
147
  # Style the axes to be completely invisible and span full width
148
+ ax.set_xlim(-5, 105) # Slightly wider to accommodate labels
149
  ax.set_ylim(0, max_y)
150
  ax.set_xlabel('')
151
  ax.set_ylabel('')