|
""" |
|
Streamlit dashboard for the Dippy Roleplay Subnet Leaderboard |
|
""" |
|
import requests |
|
import streamlit as st |
|
import pandas as pd |
|
|
|
def leaderboard_dashboard(): |
|
|
|
st.markdown("<h1 style='text-align: center;'>SN11-Dippy-Roleplay Leaderboard</h1>", unsafe_allow_html=True) |
|
st.markdown("<div style='text-align: center;'>This is the leaderboard for the Dippy validation API hosted by SN11.</div>", unsafe_allow_html=True) |
|
st.markdown("---") |
|
|
|
|
|
status_emojis = { |
|
'COMPLETED': '✅COMPLETED', |
|
'FAILED': '❌FAILED', |
|
'QUEUED': '🕒QUEUED', |
|
'RUNNING': '🏃RUNNING' |
|
} |
|
|
|
|
|
response = requests.get("http://34.41.206.211:8000/leaderboard") |
|
if response.status_code != 200: |
|
st.error("Failed to fetch leaderboard data.") |
|
return |
|
|
|
|
|
leaderboard_data = response.json() |
|
|
|
leaderboard = pd.DataFrame(leaderboard_data) |
|
|
|
leaderboard['status'] = leaderboard['status'].map(lambda status: status_emojis.get(status, status)) |
|
|
|
leaderboard = leaderboard.sort_values(by='total_score', ascending=False, ignore_index=True) |
|
|
|
front_order = ['repo_namespace', 'repo_name', 'total_score', 'status', 'chat_template_type', 'hash'] |
|
|
|
|
|
column_order = front_order + [column for column in leaderboard.columns if column not in front_order] |
|
|
|
leaderboard = leaderboard[column_order] |
|
|
|
st.dataframe(leaderboard, width=900) |
|
|
|
if __name__ == '__main__': |
|
leaderboard_dashboard() |