ror HF Staff commited on
Commit
32319bd
·
1 Parent(s): 4648f45

better space

Browse files
Files changed (1) hide show
  1. app.py +8 -8
app.py CHANGED
@@ -33,9 +33,9 @@ def create_matplotlib_bar_charts():
33
  """Create side-by-side matplotlib bar charts for TTFT and TPOT data."""
34
  data = DATA.get_ttft_tpot_data(estimator="median", use_cuda_time=False)
35
 
36
- # Create figure with dark theme - wider for side-by-side plots
37
  plt.style.use('dark_background')
38
- fig, (ax1, ax2) = plt.subplots(1, 2, figsize=(20, 12))
39
  fig.patch.set_facecolor('#000000')
40
 
41
  # Prepare data
@@ -94,26 +94,26 @@ def create_matplotlib_bar_charts():
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()
105
  plt.savefig(buffer, format='png', facecolor='#000000',
106
- bbox_inches='tight', dpi=100)
107
  buffer.seek(0)
108
 
109
  # Convert to base64 for HTML embedding
110
  img_data = base64.b64encode(buffer.getvalue()).decode()
111
  plt.close(fig)
112
 
113
- # Return HTML with embedded image - almost full height
114
  html = f"""
115
- <div style="width: 100%; height: 95vh; background: #000; display: flex; justify-content: center; align-items: center;">
116
- <img src="data:image/png;base64,{img_data}" style="max-width: 100%; max-height: 100%; object-fit: contain;" />
117
  </div>
118
  """
119
  return html
 
33
  """Create side-by-side matplotlib bar charts for TTFT and TPOT data."""
34
  data = DATA.get_ttft_tpot_data(estimator="median", use_cuda_time=False)
35
 
36
+ # Create figure with dark theme - larger for more screen space
37
  plt.style.use('dark_background')
38
+ fig, (ax1, ax2) = plt.subplots(1, 2, figsize=(24, 16))
39
  fig.patch.set_facecolor('#000000')
40
 
41
  # Prepare data
 
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=12)
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 with high DPI for crisp text
104
  buffer = io.BytesIO()
105
  plt.savefig(buffer, format='png', facecolor='#000000',
106
+ bbox_inches='tight', dpi=130)
107
  buffer.seek(0)
108
 
109
  # Convert to base64 for HTML embedding
110
  img_data = base64.b64encode(buffer.getvalue()).decode()
111
  plt.close(fig)
112
 
113
+ # Return HTML with embedded image - full height
114
  html = f"""
115
+ <div style="width: 100%; height: 100vh; background: #000; display: flex; justify-content: center; align-items: center;">
116
+ <img src="data:image/png;base64,{img_data}" style="width: 100%; height: 100%; object-fit: contain;" />
117
  </div>
118
  """
119
  return html