Spaces:
Runtime error
Runtime error
Update app.py
Browse files
app.py
CHANGED
@@ -41,21 +41,59 @@ async def get_leaderboard_data():
|
|
41 |
except Exception as e:
|
42 |
print(f"Error fetching leaderboard data: {e}")
|
43 |
return []
|
44 |
-
|
45 |
async def update_leaderboard_table():
|
46 |
leaderboard_data = await get_leaderboard_data()
|
47 |
return leaderboard_data
|
48 |
|
49 |
with gr.Blocks(css="""
|
50 |
-
|
51 |
-
width: 100%;
|
52 |
background-color: white;
|
53 |
-
font-size: 16px;
|
54 |
color: black;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
55 |
}
|
56 |
""") as demo:
|
57 |
-
gr.Markdown("#
|
58 |
-
|
59 |
leaderboard_table = gr.components.Dataframe(
|
60 |
headers=["rank", "uid", "score"],
|
61 |
datatype=["number", "number", "number"],
|
@@ -63,10 +101,10 @@ with gr.Blocks(css="""
|
|
63 |
visible=True,
|
64 |
elem_id="leaderboard-table"
|
65 |
)
|
66 |
-
|
67 |
refresh_button = gr.Button("Refresh Leaderboard")
|
68 |
refresh_button.click(fn=update_leaderboard_table, outputs=leaderboard_table)
|
69 |
-
|
70 |
# Initial load of leaderboard data
|
71 |
demo.load(update_leaderboard_table, inputs=None, outputs=leaderboard_table)
|
72 |
|
|
|
41 |
except Exception as e:
|
42 |
print(f"Error fetching leaderboard data: {e}")
|
43 |
return []
|
44 |
+
|
45 |
async def update_leaderboard_table():
|
46 |
leaderboard_data = await get_leaderboard_data()
|
47 |
return leaderboard_data
|
48 |
|
49 |
with gr.Blocks(css="""
|
50 |
+
body {
|
|
|
51 |
background-color: white;
|
|
|
52 |
color: black;
|
53 |
+
font-family: Arial, sans-serif;
|
54 |
+
font-size: 16px;
|
55 |
+
}
|
56 |
+
|
57 |
+
.gradio-container {
|
58 |
+
max-width: 800px;
|
59 |
+
margin: 0 auto;
|
60 |
+
padding: 20px;
|
61 |
+
}
|
62 |
+
|
63 |
+
.gradio-dataframe {
|
64 |
+
width: 100%;
|
65 |
+
background-color: #f5f5f5;
|
66 |
+
border-collapse: collapse;
|
67 |
+
margin-top: 20px;
|
68 |
+
}
|
69 |
+
|
70 |
+
.gradio-dataframe th,
|
71 |
+
.gradio-dataframe td {
|
72 |
+
padding: 10px;
|
73 |
+
text-align: left;
|
74 |
+
border-bottom: 1px solid #ddd;
|
75 |
+
}
|
76 |
+
|
77 |
+
.gradio-dataframe th {
|
78 |
+
background-color: #f2f2f2;
|
79 |
+
font-weight: bold;
|
80 |
+
}
|
81 |
+
|
82 |
+
.gradio-button {
|
83 |
+
background-color: #4CAF50;
|
84 |
+
color: white;
|
85 |
+
padding: 10px 20px;
|
86 |
+
border: none;
|
87 |
+
cursor: pointer;
|
88 |
+
margin-top: 20px;
|
89 |
+
}
|
90 |
+
|
91 |
+
.gradio-button:hover {
|
92 |
+
background-color: #45a049;
|
93 |
}
|
94 |
""") as demo:
|
95 |
+
gr.Markdown("# Synthia Leaderboard")
|
96 |
+
|
97 |
leaderboard_table = gr.components.Dataframe(
|
98 |
headers=["rank", "uid", "score"],
|
99 |
datatype=["number", "number", "number"],
|
|
|
101 |
visible=True,
|
102 |
elem_id="leaderboard-table"
|
103 |
)
|
104 |
+
|
105 |
refresh_button = gr.Button("Refresh Leaderboard")
|
106 |
refresh_button.click(fn=update_leaderboard_table, outputs=leaderboard_table)
|
107 |
+
|
108 |
# Initial load of leaderboard data
|
109 |
demo.load(update_leaderboard_table, inputs=None, outputs=leaderboard_table)
|
110 |
|