xhluca commited on
Commit ·
5f4cbc5
1
Parent(s): c6bd9a8
Fix Space startup health check
Browse files- README.md +2 -1
- app.py +17 -6
- requirements.txt +3 -10
README.md
CHANGED
|
@@ -5,10 +5,11 @@ colorFrom: green
|
|
| 5 |
colorTo: indigo
|
| 6 |
sdk: gradio
|
| 7 |
app_file: app.py
|
|
|
|
| 8 |
pinned: false
|
| 9 |
license: apache-2.0
|
| 10 |
short_description: Leaderboard for AgentRewardBench
|
| 11 |
sdk_version: 5.19.0
|
| 12 |
---
|
| 13 |
|
| 14 |
-
# Agent Reward Bench Leaderboard
|
|
|
|
| 5 |
colorTo: indigo
|
| 6 |
sdk: gradio
|
| 7 |
app_file: app.py
|
| 8 |
+
python_version: "3.11"
|
| 9 |
pinned: false
|
| 10 |
license: apache-2.0
|
| 11 |
short_description: Leaderboard for AgentRewardBench
|
| 12 |
sdk_version: 5.19.0
|
| 13 |
---
|
| 14 |
|
| 15 |
+
# Agent Reward Bench Leaderboard
|
app.py
CHANGED
|
@@ -2,22 +2,28 @@
|
|
| 2 |
gradio app that reads results.jsonl and display it in a table, title is "AgentRewardBench Leaderboard"
|
| 3 |
"""
|
| 4 |
|
| 5 |
-
import gradio as gr
|
| 6 |
import json
|
|
|
|
|
|
|
|
|
|
|
|
|
| 7 |
import pandas as pd
|
| 8 |
|
| 9 |
|
|
|
|
|
|
|
|
|
|
| 10 |
def load_data():
|
| 11 |
# read the jsonl file
|
| 12 |
data = []
|
| 13 |
-
with open("
|
| 14 |
for line in f:
|
| 15 |
if line.strip():
|
| 16 |
data.append(json.loads(line))
|
| 17 |
|
| 18 |
df = pd.DataFrame(data)
|
| 19 |
# remove Recall and F1 columns
|
| 20 |
-
df = df.drop(columns=["Recall", "F1"])
|
| 21 |
|
| 22 |
# if a field called "Overall" exists, sort the dataframe by "Overall"
|
| 23 |
if "Overall" in df.columns:
|
|
@@ -31,7 +37,7 @@ def load_data():
|
|
| 31 |
|
| 32 |
# if a field called "Logs URL" exists, add a link to the logs url
|
| 33 |
if "Logs URL" in df.columns:
|
| 34 |
-
df["Logs"] = df["Logs URL"].apply(lambda x: f"[🔗]({x})" if x
|
| 35 |
df = df.drop(columns=["Logs URL"])
|
| 36 |
|
| 37 |
# return the dataframe
|
|
@@ -54,6 +60,11 @@ with gr.Blocks() as demo:
|
|
| 54 |
"""
|
| 55 |
)
|
| 56 |
df = load_data()
|
| 57 |
-
|
|
|
|
| 58 |
|
| 59 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 2 |
gradio app that reads results.jsonl and display it in a table, title is "AgentRewardBench Leaderboard"
|
| 3 |
"""
|
| 4 |
|
|
|
|
| 5 |
import json
|
| 6 |
+
import os
|
| 7 |
+
from pathlib import Path
|
| 8 |
+
|
| 9 |
+
import gradio as gr
|
| 10 |
import pandas as pd
|
| 11 |
|
| 12 |
|
| 13 |
+
RESULTS_PATH = Path(__file__).with_name("results.jsonl")
|
| 14 |
+
|
| 15 |
+
|
| 16 |
def load_data():
|
| 17 |
# read the jsonl file
|
| 18 |
data = []
|
| 19 |
+
with RESULTS_PATH.open("r", encoding="utf-8") as f:
|
| 20 |
for line in f:
|
| 21 |
if line.strip():
|
| 22 |
data.append(json.loads(line))
|
| 23 |
|
| 24 |
df = pd.DataFrame(data)
|
| 25 |
# remove Recall and F1 columns
|
| 26 |
+
df = df.drop(columns=["Recall", "F1"], errors="ignore")
|
| 27 |
|
| 28 |
# if a field called "Overall" exists, sort the dataframe by "Overall"
|
| 29 |
if "Overall" in df.columns:
|
|
|
|
| 37 |
|
| 38 |
# if a field called "Logs URL" exists, add a link to the logs url
|
| 39 |
if "Logs URL" in df.columns:
|
| 40 |
+
df["Logs"] = df["Logs URL"].apply(lambda x: f"[🔗]({x})" if pd.notna(x) and x else "✖️")
|
| 41 |
df = df.drop(columns=["Logs URL"])
|
| 42 |
|
| 43 |
# return the dataframe
|
|
|
|
| 60 |
"""
|
| 61 |
)
|
| 62 |
df = load_data()
|
| 63 |
+
gr.DataFrame(df, show_label=False, datatype="markdown")
|
| 64 |
+
|
| 65 |
|
| 66 |
+
if __name__ == "__main__":
|
| 67 |
+
demo.queue(default_concurrency_limit=40).launch(
|
| 68 |
+
server_name="0.0.0.0",
|
| 69 |
+
server_port=int(os.getenv("PORT", "7860")),
|
| 70 |
+
)
|
requirements.txt
CHANGED
|
@@ -1,10 +1,3 @@
|
|
| 1 |
-
|
| 2 |
-
|
| 3 |
-
|
| 4 |
-
gradio
|
| 5 |
-
gradio[oauth]
|
| 6 |
-
gradio_client
|
| 7 |
-
huggingface-hub>=0.18.0
|
| 8 |
-
numpy
|
| 9 |
-
pandas
|
| 10 |
-
tqdm
|
|
|
|
| 1 |
+
gradio==5.19.0
|
| 2 |
+
pandas>=2.2,<3
|
| 3 |
+
requests>=2.32
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|