Spaces:
Running
Running
Update app.py
Browse files
app.py
CHANGED
@@ -106,36 +106,39 @@ def create_stats_html():
|
|
106 |
type_dist['model_type'] = type_dist['model_type'].str.capitalize()
|
107 |
|
108 |
# Create bar chart with better formatting
|
109 |
-
fig_types =
|
110 |
-
|
111 |
-
|
112 |
-
|
113 |
-
|
114 |
-
|
115 |
-
|
116 |
-
|
117 |
-
|
118 |
-
text=type_dist['downloads_30d'].apply(format_number) # Add value labels
|
119 |
-
)
|
120 |
|
121 |
-
# Update layout
|
122 |
-
fig_types.update_traces(textposition='outside')
|
123 |
fig_types.update_layout(
|
124 |
-
|
125 |
-
|
126 |
-
|
127 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
128 |
plot_bgcolor='white',
|
129 |
bargap=0.3,
|
130 |
-
|
131 |
-
|
132 |
-
|
133 |
-
)
|
134 |
)
|
135 |
|
136 |
else:
|
137 |
# Create empty figure if no data
|
138 |
-
fig_types =
|
139 |
|
140 |
# Create top models table
|
141 |
if len(derivative_df) > 0:
|
|
|
106 |
type_dist['model_type'] = type_dist['model_type'].str.capitalize()
|
107 |
|
108 |
# Create bar chart with better formatting
|
109 |
+
fig_types = go.Figure()
|
110 |
+
|
111 |
+
# Add bars
|
112 |
+
fig_types.add_trace(go.Bar(
|
113 |
+
x=type_dist['model_type'],
|
114 |
+
y=type_dist['downloads_30d'],
|
115 |
+
text=type_dist['downloads_30d'].apply(format_number),
|
116 |
+
textposition='outside',
|
117 |
+
))
|
|
|
|
|
118 |
|
119 |
+
# Update layout
|
|
|
120 |
fig_types.update_layout(
|
121 |
+
title='Downloads by Model Type',
|
122 |
+
yaxis_type="log", # Set y-axis to log scale
|
123 |
+
yaxis=dict(
|
124 |
+
title="Downloads",
|
125 |
+
type='log',
|
126 |
+
dtick=1, # This controls the tick spacing
|
127 |
+
tickformat=".1s" # Format ticks with K, M suffix
|
128 |
+
),
|
129 |
+
xaxis=dict(
|
130 |
+
title="Model Type"
|
131 |
+
),
|
132 |
plot_bgcolor='white',
|
133 |
bargap=0.3,
|
134 |
+
height=600,
|
135 |
+
showlegend=False,
|
136 |
+
margin=dict(t=100, b=50) # Add margin for labels
|
|
|
137 |
)
|
138 |
|
139 |
else:
|
140 |
# Create empty figure if no data
|
141 |
+
fig_types = go.Figure()
|
142 |
|
143 |
# Create top models table
|
144 |
if len(derivative_df) > 0:
|