Manavshah commited on
Commit
1629593
1 Parent(s): 08f5f02

first commit

Browse files
Files changed (1) hide show
  1. app.py +47 -0
app.py ADDED
@@ -0,0 +1,47 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ """
2
+ Streamlit dashboard for the Dippy Roleplay Subnet Leaderboard
3
+ """
4
+ import requests
5
+ import streamlit as st
6
+ import pandas as pd
7
+
8
+ def leaderboard_dashboard():
9
+ # st.image("banner.jpg")
10
+ st.markdown("<h1 style='text-align: center;'>SN11-Dippy-Roleplay Leaderboard</h1>", unsafe_allow_html=True)
11
+ st.markdown("<div style='text-align: center;'>This is the leaderboard for the Dippy validation API hosted by SN11.</div>", unsafe_allow_html=True)
12
+ st.markdown("---")
13
+
14
+ # Add emojis based on the status
15
+ status_emojis = {
16
+ 'COMPLETED': '✅COMPLETED',
17
+ 'FAILED': '❌FAILED',
18
+ 'QUEUED': '🕒QUEUED',
19
+ 'RUNNING': '🏃RUNNING'
20
+ }
21
+
22
+ # Get the leaderboard data from the API
23
+ response = requests.get("http://34.41.206.211:8000/leaderboard")
24
+ if response.status_code != 200:
25
+ st.error("Failed to fetch leaderboard data.")
26
+ return
27
+
28
+ # Parse the response JSON data
29
+ leaderboard_data = response.json()
30
+ # Convert the data to a DataFrame
31
+ leaderboard = pd.DataFrame(leaderboard_data)
32
+
33
+ leaderboard['status'] = leaderboard['status'].map(lambda status: status_emojis.get(status, status))
34
+ # Sort the leaderboard by the total_score column
35
+ leaderboard = leaderboard.sort_values(by='total_score', ascending=False, ignore_index=True)
36
+
37
+ front_order = ['repo_namespace', 'repo_name', 'total_score', 'status', 'chat_template_type', 'hash']
38
+
39
+ # move status column to the front
40
+ column_order = front_order + [column for column in leaderboard.columns if column not in front_order]
41
+
42
+ leaderboard = leaderboard[column_order]
43
+
44
+ st.dataframe(leaderboard, width=900)
45
+
46
+ if __name__ == '__main__':
47
+ leaderboard_dashboard()