ror HF Staff commited on
Commit
0ad3140
·
1 Parent(s): 0eac02e
Files changed (1) hide show
  1. app.py +13 -12
app.py CHANGED
@@ -67,16 +67,13 @@ def create_matplotlib_bar_charts():
67
  # TTFT Plot (left)
68
  ax1.set_facecolor('#000000')
69
  bars1 = ax1.bar(range(len(labels)), ttft_values,
70
- color=colors, width=1.0, edgecolor='white', linewidth=1)
 
71
 
72
- ax1.set_xlabel('Model Configuration', color='white', fontsize=14)
73
  ax1.set_ylabel('TTFT (seconds)', color='white', fontsize=14)
74
  ax1.set_title('Time To First Token by Configuration', color='white', fontsize=16, pad=20)
75
 
76
- ax1.set_xticks(range(len(labels)))
77
- ax1.set_xticklabels([label[:12] + '...' if len(label) > 12 else label for label in labels],
78
- rotation=45, ha='right', color='white', fontsize=10)
79
-
80
  ax1.tick_params(colors='white')
81
  ax1.grid(True, alpha=0.3, color='white')
82
 
@@ -85,19 +82,23 @@ def create_matplotlib_bar_charts():
85
  bars2 = ax2.bar(range(len(labels)), tpot_values,
86
  color=colors, width=1.0, edgecolor='white', linewidth=1)
87
 
88
- ax2.set_xlabel('Model Configuration', color='white', fontsize=14)
89
  ax2.set_ylabel('TPOT (seconds)', color='white', fontsize=14)
90
  ax2.set_title('Time Per Output Token by Configuration', color='white', fontsize=16, pad=20)
91
 
92
- ax2.set_xticks(range(len(labels)))
93
- ax2.set_xticklabels([label[:12] + '...' if len(label) > 12 else label for label in labels],
94
- rotation=45, ha='right', color='white', fontsize=10)
95
-
96
  ax2.tick_params(colors='white')
97
  ax2.grid(True, alpha=0.3, color='white')
98
 
99
- # Tight layout to prevent label cutoff
 
 
 
 
 
 
 
100
  plt.tight_layout()
 
101
 
102
  # Save plot to bytes
103
  buffer = io.BytesIO()
 
67
  # TTFT Plot (left)
68
  ax1.set_facecolor('#000000')
69
  bars1 = ax1.bar(range(len(labels)), ttft_values,
70
+ color=colors, width=1.0, edgecolor='white', linewidth=1,
71
+ label=[label[:15] + '...' if len(label) > 15 else label for label in labels])
72
 
 
73
  ax1.set_ylabel('TTFT (seconds)', color='white', fontsize=14)
74
  ax1.set_title('Time To First Token by Configuration', color='white', fontsize=16, pad=20)
75
 
76
+ ax1.set_xticks([])
 
 
 
77
  ax1.tick_params(colors='white')
78
  ax1.grid(True, alpha=0.3, color='white')
79
 
 
82
  bars2 = ax2.bar(range(len(labels)), tpot_values,
83
  color=colors, width=1.0, edgecolor='white', linewidth=1)
84
 
 
85
  ax2.set_ylabel('TPOT (seconds)', color='white', fontsize=14)
86
  ax2.set_title('Time Per Output Token by Configuration', color='white', fontsize=16, pad=20)
87
 
88
+ ax2.set_xticks([])
 
 
 
89
  ax2.tick_params(colors='white')
90
  ax2.grid(True, alpha=0.3, color='white')
91
 
92
+ # Add common legend with full text
93
+ legend_labels = labels # Use full labels without truncation
94
+ legend_handles = [plt.Rectangle((0,0),1,1, color=color, edgecolor='white') for color in colors]
95
+ fig.legend(legend_handles, legend_labels, loc='lower center', ncol=1,
96
+ bbox_to_anchor=(0.5, -0.05), facecolor='black', edgecolor='white',
97
+ labelcolor='white', fontsize=9)
98
+
99
+ # Tight layout with spacing between subplots and extra bottom space for legend
100
  plt.tight_layout()
101
+ plt.subplots_adjust(wspace=0.3, bottom=0.075)
102
 
103
  # Save plot to bytes
104
  buffer = io.BytesIO()