Update app.py
Browse files
app.py
CHANGED
|
@@ -280,8 +280,8 @@ with st.sidebar:
|
|
| 280 |
|
| 281 |
# Create tabs for Spaces and Models rankings - ONLY SHOWING FIRST TWO TABS
|
| 282 |
tab1, tab2 = st.tabs([
|
| 283 |
-
"
|
| 284 |
-
"
|
| 285 |
])
|
| 286 |
|
| 287 |
with tab1:
|
|
@@ -324,7 +324,7 @@ with st.sidebar:
|
|
| 324 |
|
| 325 |
with tab2:
|
| 326 |
# Show trending accounts list by Spaces
|
| 327 |
-
st.subheader("🚀 Top 100 by Spaces")
|
| 328 |
|
| 329 |
# Display the top 100 accounts list
|
| 330 |
st.markdown("### Spaces Contributors Ranking")
|
|
@@ -361,6 +361,42 @@ with st.sidebar:
|
|
| 361 |
ax.set_xlabel("Number of Spaces")
|
| 362 |
plt.tight_layout()
|
| 363 |
st.pyplot(fig)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 364 |
|
| 365 |
# Display trending accounts selection dropdown
|
| 366 |
st.subheader("Select Contributor")
|
|
|
|
| 280 |
|
| 281 |
# Create tabs for Spaces and Models rankings - ONLY SHOWING FIRST TWO TABS
|
| 282 |
tab1, tab2 = st.tabs([
|
| 283 |
+
"Top 100 Overall Contributors",
|
| 284 |
+
"Top 100 by Spaces & Models"
|
| 285 |
])
|
| 286 |
|
| 287 |
with tab1:
|
|
|
|
| 324 |
|
| 325 |
with tab2:
|
| 326 |
# Show trending accounts list by Spaces
|
| 327 |
+
st.subheader("🚀 Top 100 by Spaces & Models")
|
| 328 |
|
| 329 |
# Display the top 100 accounts list
|
| 330 |
st.markdown("### Spaces Contributors Ranking")
|
|
|
|
| 361 |
ax.set_xlabel("Number of Spaces")
|
| 362 |
plt.tight_layout()
|
| 363 |
st.pyplot(fig)
|
| 364 |
+
|
| 365 |
+
# Display the top 100 Models accounts list (ADDED SECTION)
|
| 366 |
+
st.markdown("### Models Contributors Ranking")
|
| 367 |
+
|
| 368 |
+
# Create a data frame for the Models table
|
| 369 |
+
if top_owners_models:
|
| 370 |
+
ranking_data_models = pd.DataFrame(top_owners_models[:100], columns=["Contributor", "Models Count"])
|
| 371 |
+
ranking_data_models.index = ranking_data_models.index + 1 # Start index from 1 for ranking
|
| 372 |
+
|
| 373 |
+
st.dataframe(
|
| 374 |
+
ranking_data_models,
|
| 375 |
+
column_config={
|
| 376 |
+
"Contributor": st.column_config.TextColumn("Contributor"),
|
| 377 |
+
"Models Count": st.column_config.NumberColumn("Models Count (based on top 500 models)", format="%d")
|
| 378 |
+
},
|
| 379 |
+
use_container_width=True,
|
| 380 |
+
hide_index=False
|
| 381 |
+
)
|
| 382 |
+
|
| 383 |
+
# Add stats expander with visualization for Models (ADDED SECTION)
|
| 384 |
+
with st.expander("View Top 30 Models Contributors Chart"):
|
| 385 |
+
# Create a bar chart for top 30 models contributors
|
| 386 |
+
if top_owners_models:
|
| 387 |
+
chart_data = pd.DataFrame(top_owners_models[:30], columns=["Owner", "Models Count"])
|
| 388 |
+
|
| 389 |
+
fig, ax = plt.subplots(figsize=(10, 8))
|
| 390 |
+
bars = ax.barh(chart_data["Owner"], chart_data["Models Count"])
|
| 391 |
+
|
| 392 |
+
# Add color gradient to bars
|
| 393 |
+
for i, bar in enumerate(bars):
|
| 394 |
+
bar.set_color(plt.cm.plasma(i/len(bars))) # Using a different colormap for distinction
|
| 395 |
+
|
| 396 |
+
ax.set_title("Top 30 Contributors by Number of Models")
|
| 397 |
+
ax.set_xlabel("Number of Models")
|
| 398 |
+
plt.tight_layout()
|
| 399 |
+
st.pyplot(fig)
|
| 400 |
|
| 401 |
# Display trending accounts selection dropdown
|
| 402 |
st.subheader("Select Contributor")
|