Update app.py
Browse files
app.py
CHANGED
|
@@ -22,11 +22,13 @@ def initialize_leaderboard_file():
|
|
| 22 |
"""
|
| 23 |
if not os.path.exists(LEADERBOARD_FILE):
|
| 24 |
pd.DataFrame(columns=[
|
| 25 |
-
|
|
|
|
| 26 |
]).to_csv(LEADERBOARD_FILE, index=False)
|
| 27 |
elif os.stat(LEADERBOARD_FILE).st_size == 0:
|
| 28 |
pd.DataFrame(columns=[
|
| 29 |
-
"Model Name", "Overall Accuracy", "
|
|
|
|
| 30 |
]).to_csv(LEADERBOARD_FILE, index=False)
|
| 31 |
|
| 32 |
def clean_answer(answer):
|
|
@@ -42,8 +44,11 @@ def update_leaderboard(results):
|
|
| 42 |
Append new submission results to the leaderboard file and push updates to the Hugging Face repository.
|
| 43 |
"""
|
| 44 |
new_entry = {
|
| 45 |
-
|
| 46 |
"Overall Accuracy": round(results['overall_accuracy'] * 100, 2),
|
|
|
|
|
|
|
|
|
|
| 47 |
"Timestamp": datetime.now().strftime("%Y-%m-%d %H:%M:%S"),
|
| 48 |
}
|
| 49 |
|
|
@@ -83,6 +88,9 @@ def load_leaderboard():
|
|
| 83 |
return pd.DataFrame({
|
| 84 |
"Model Name": [],
|
| 85 |
"Overall Accuracy": [],
|
|
|
|
|
|
|
|
|
|
| 86 |
"Timestamp": [],
|
| 87 |
})
|
| 88 |
return pd.read_csv(LEADERBOARD_FILE)
|
|
|
|
| 22 |
"""
|
| 23 |
if not os.path.exists(LEADERBOARD_FILE):
|
| 24 |
pd.DataFrame(columns=[
|
| 25 |
+
"Model Name", "Overall Accuracy", "Valid Accuracy",
|
| 26 |
+
"Correct Predictions", "Total Questions", "Timestamp"
|
| 27 |
]).to_csv(LEADERBOARD_FILE, index=False)
|
| 28 |
elif os.stat(LEADERBOARD_FILE).st_size == 0:
|
| 29 |
pd.DataFrame(columns=[
|
| 30 |
+
"Model Name", "Overall Accuracy", "Valid Accuracy",
|
| 31 |
+
"Correct Predictions", "Total Questions", "Timestamp"
|
| 32 |
]).to_csv(LEADERBOARD_FILE, index=False)
|
| 33 |
|
| 34 |
def clean_answer(answer):
|
|
|
|
| 44 |
Append new submission results to the leaderboard file and push updates to the Hugging Face repository.
|
| 45 |
"""
|
| 46 |
new_entry = {
|
| 47 |
+
"Model Name": results['model_name'],
|
| 48 |
"Overall Accuracy": round(results['overall_accuracy'] * 100, 2),
|
| 49 |
+
"Valid Accuracy": round(results['valid_accuracy'] * 100, 2),
|
| 50 |
+
"Correct Predictions": results['correct_predictions'],
|
| 51 |
+
"Total Questions": results['total_questions'],
|
| 52 |
"Timestamp": datetime.now().strftime("%Y-%m-%d %H:%M:%S"),
|
| 53 |
}
|
| 54 |
|
|
|
|
| 88 |
return pd.DataFrame({
|
| 89 |
"Model Name": [],
|
| 90 |
"Overall Accuracy": [],
|
| 91 |
+
"Valid Accuracy": [],
|
| 92 |
+
"Correct Predictions": [],
|
| 93 |
+
"Total Questions": [],
|
| 94 |
"Timestamp": [],
|
| 95 |
})
|
| 96 |
return pd.read_csv(LEADERBOARD_FILE)
|