Spaces:
Running
Running
Cleanup
Browse files
app.py
CHANGED
@@ -83,53 +83,6 @@ def background_refresh():
|
|
83 |
print(f"Background refresh error: {e}")
|
84 |
|
85 |
|
86 |
-
def create_table_for_lb(lb_data):
|
87 |
-
headers = [
|
88 |
-
"Rank",
|
89 |
-
"User Name",
|
90 |
-
"Submission Name",
|
91 |
-
"Runtime (ms)",
|
92 |
-
"Submission Date",
|
93 |
-
]
|
94 |
-
|
95 |
-
rows = []
|
96 |
-
for i, result in enumerate(lb_data.results, 1):
|
97 |
-
rank_display = i
|
98 |
-
if i == 1:
|
99 |
-
rank_display = "🥇 1"
|
100 |
-
elif i == 2:
|
101 |
-
rank_display = "🥈 2"
|
102 |
-
elif i == 3:
|
103 |
-
rank_display = "🥉 3"
|
104 |
-
|
105 |
-
submission_score = float(float(result.submission_score) * 1000)
|
106 |
-
|
107 |
-
rows.append(
|
108 |
-
[
|
109 |
-
rank_display,
|
110 |
-
result.user_name,
|
111 |
-
result.submission_name,
|
112 |
-
f"{submission_score:.4f}",
|
113 |
-
result.submission_time.strftime("%Y-%m-%d %H:%M:%S"),
|
114 |
-
]
|
115 |
-
)
|
116 |
-
|
117 |
-
df = gr.Dataframe(
|
118 |
-
headers=headers,
|
119 |
-
datatype=[
|
120 |
-
"str",
|
121 |
-
"int",
|
122 |
-
"str",
|
123 |
-
"str",
|
124 |
-
"timestamp",
|
125 |
-
],
|
126 |
-
value=rows,
|
127 |
-
interactive=False,
|
128 |
-
)
|
129 |
-
|
130 |
-
return df
|
131 |
-
|
132 |
-
|
133 |
def build_ui():
|
134 |
# Define the function first before using it
|
135 |
def create_table_for_lb_with_global_rank(lb_data, offset):
|
@@ -165,7 +118,7 @@ def build_ui():
|
|
165 |
result.user_name,
|
166 |
str(result.submission_id), # Add submission ID as a new column
|
167 |
result.submission_name,
|
168 |
-
f"{float(result.submission_score):.4f}",
|
169 |
result.submission_time.strftime("%Y-%m-%d %H:%M:%S"),
|
170 |
]
|
171 |
)
|
|
|
83 |
print(f"Background refresh error: {e}")
|
84 |
|
85 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
86 |
def build_ui():
|
87 |
# Define the function first before using it
|
88 |
def create_table_for_lb_with_global_rank(lb_data, offset):
|
|
|
118 |
result.user_name,
|
119 |
str(result.submission_id), # Add submission ID as a new column
|
120 |
result.submission_name,
|
121 |
+
f"{float(result.submission_score) * 1000:.4f}",
|
122 |
result.submission_time.strftime("%Y-%m-%d %H:%M:%S"),
|
123 |
]
|
124 |
)
|