Spaces:
Sleeping
Sleeping
better space
Browse files
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 -
|
| 37 |
plt.style.use('dark_background')
|
| 38 |
-
fig, (ax1, ax2) = plt.subplots(1, 2, figsize=(
|
| 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=
|
| 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=
|
| 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 -
|
| 114 |
html = f"""
|
| 115 |
-
<div style="width: 100%; height:
|
| 116 |
-
<img src="data:image/png;base64,{img_data}" style="
|
| 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
|