Spaces:
Sleeping
Sleeping
darisdzakwanhoesien2
commited on
Commit
·
0eb435a
1
Parent(s):
bc75d52
Update app.py and evaluate.py with latest changes
Browse files- app.py +1 -1
- metrics/evaluate.py +2 -2
app.py
CHANGED
|
@@ -120,7 +120,7 @@ with gr.Blocks(title="IndoNLP Dashboard") as demo:
|
|
| 120 |
new_entry = {"task": "Sentiment", "model": model_key, **res['metrics']}
|
| 121 |
# append and save
|
| 122 |
global leaderboard
|
| 123 |
-
leaderboard = leaderboard.
|
| 124 |
save_leaderboard(leaderboard, LEADERBOARD_PATH)
|
| 125 |
# build confusion matrix plot
|
| 126 |
cm = res.get('confusion_matrix')
|
|
|
|
| 120 |
new_entry = {"task": "Sentiment", "model": model_key, **res['metrics']}
|
| 121 |
# append and save
|
| 122 |
global leaderboard
|
| 123 |
+
leaderboard = pd.concat([leaderboard, pd.DataFrame([new_entry])], ignore_index=True)
|
| 124 |
save_leaderboard(leaderboard, LEADERBOARD_PATH)
|
| 125 |
# build confusion matrix plot
|
| 126 |
cm = res.get('confusion_matrix')
|
metrics/evaluate.py
CHANGED
|
@@ -158,7 +158,7 @@ def evaluate_qa(file, model_key: str) -> Dict[str, Any]:
|
|
| 158 |
|
| 159 |
|
| 160 |
def load_leaderboard(path: str):
|
| 161 |
-
if not os.path.exists(path):
|
| 162 |
# default
|
| 163 |
df = pd.DataFrame([{"task": "Sentiment", "model": "indobert", "f1": 0.88, "accuracy": 0.87}])
|
| 164 |
df.to_json(path, orient='records')
|
|
@@ -167,4 +167,4 @@ def load_leaderboard(path: str):
|
|
| 167 |
|
| 168 |
|
| 169 |
def save_leaderboard(df, path: str):
|
| 170 |
-
|
|
|
|
| 158 |
|
| 159 |
|
| 160 |
def load_leaderboard(path: str):
|
| 161 |
+
if not os.path.exists(path) or os.path.getsize(path) == 0:
|
| 162 |
# default
|
| 163 |
df = pd.DataFrame([{"task": "Sentiment", "model": "indobert", "f1": 0.88, "accuracy": 0.87}])
|
| 164 |
df.to_json(path, orient='records')
|
|
|
|
| 167 |
|
| 168 |
|
| 169 |
def save_leaderboard(df, path: str):
|
| 170 |
+
return pd.read_json(path)
|