Spaces:
Sleeping
Sleeping
Alex
commited on
Commit
·
c762a51
1
Parent(s):
ea6e048
error
Browse files
app.py
CHANGED
|
@@ -78,6 +78,9 @@ def _flatten_entry(entry: Dict) -> Dict:
|
|
| 78 |
|
| 79 |
def _table_data() -> List[Dict]:
|
| 80 |
data = _load_leaderboard()
|
|
|
|
|
|
|
|
|
|
| 81 |
# Sort descending by pass@1 as requested
|
| 82 |
data.sort(key=lambda x: x["llm_pass_1"], reverse=True)
|
| 83 |
return [_flatten_entry(e) for e in data]
|
|
@@ -139,11 +142,39 @@ def submit_model(
|
|
| 139 |
with gr.Blocks(title="Custom LLM Leaderboard") as demo:
|
| 140 |
gr.Markdown("""# 🏆 LLM Leaderboard\nSubmit your model results below. Leaderboard is sorted by **Pass@1**. """)
|
| 141 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 142 |
# Initialize table data
|
| 143 |
initial_data = _table_data()
|
| 144 |
|
| 145 |
leaderboard_df = gr.Dataframe(
|
| 146 |
-
headers=
|
| 147 |
value=initial_data,
|
| 148 |
label="Current Leaderboard",
|
| 149 |
interactive=False,
|
|
|
|
| 78 |
|
| 79 |
def _table_data() -> List[Dict]:
|
| 80 |
data = _load_leaderboard()
|
| 81 |
+
if not data:
|
| 82 |
+
# Return empty list if no data
|
| 83 |
+
return []
|
| 84 |
# Sort descending by pass@1 as requested
|
| 85 |
data.sort(key=lambda x: x["llm_pass_1"], reverse=True)
|
| 86 |
return [_flatten_entry(e) for e in data]
|
|
|
|
| 142 |
with gr.Blocks(title="Custom LLM Leaderboard") as demo:
|
| 143 |
gr.Markdown("""# 🏆 LLM Leaderboard\nSubmit your model results below. Leaderboard is sorted by **Pass@1**. """)
|
| 144 |
|
| 145 |
+
# Create initial example data if file doesn't exist
|
| 146 |
+
if not LEADERBOARD_PATH.exists():
|
| 147 |
+
example_data = {
|
| 148 |
+
"leaderboard": [
|
| 149 |
+
{
|
| 150 |
+
"model_name": "example/model",
|
| 151 |
+
"bleu": 0.5,
|
| 152 |
+
"llm_pass_1": 0.5,
|
| 153 |
+
"llm_pass_5": 0.5,
|
| 154 |
+
"llm_pass_10": 0.5,
|
| 155 |
+
"metrics": {
|
| 156 |
+
"readability": 5,
|
| 157 |
+
"relevance": 5,
|
| 158 |
+
"explanation_clarity": 5,
|
| 159 |
+
"problem_identification": 5,
|
| 160 |
+
"actionability": 5,
|
| 161 |
+
"completeness": 5,
|
| 162 |
+
"specificity": 5,
|
| 163 |
+
"contextual_adequacy": 5,
|
| 164 |
+
"consistency": 5,
|
| 165 |
+
"brevity": 5
|
| 166 |
+
}
|
| 167 |
+
}
|
| 168 |
+
]
|
| 169 |
+
}
|
| 170 |
+
with LEADERBOARD_PATH.open("w", encoding="utf-8") as f:
|
| 171 |
+
json.dump(example_data, f, indent=2)
|
| 172 |
+
|
| 173 |
# Initialize table data
|
| 174 |
initial_data = _table_data()
|
| 175 |
|
| 176 |
leaderboard_df = gr.Dataframe(
|
| 177 |
+
headers=["Model", "BLEU", "Pass@1", "Pass@5", "Pass@10", "Readability", "Relevance", "Explanation Clarity", "Problem Identification", "Actionability", "Completeness", "Specificity", "Contextual Adequacy", "Consistency", "Brevity"],
|
| 178 |
value=initial_data,
|
| 179 |
label="Current Leaderboard",
|
| 180 |
interactive=False,
|