tohid.abedini
commited on
Commit
·
d779abf
1
Parent(s):
744607e
[Add] jsonl load handling
Browse files
app.py
CHANGED
@@ -10,7 +10,7 @@ import json
|
|
10 |
import requests
|
11 |
|
12 |
from envs import API, EVAL_REQUESTS_PATH, TOKEN, QUEUE_REPO
|
13 |
-
from utils import LLM_BENCHMARKS_ABOUT_TEXT, LLM_BENCHMARKS_SUBMIT_TEXT, custom_css,
|
14 |
|
15 |
|
16 |
|
@@ -102,7 +102,7 @@ abs_path = Path(__file__).parent
|
|
102 |
|
103 |
# Any pandas-compatible data
|
104 |
# persian_df = pd.read_json(str(abs_path / "leaderboard_persian.jsonl"))
|
105 |
-
persian_df =
|
106 |
base_df = pd.read_json(str(abs_path / "leaderboard_base.json"))
|
107 |
|
108 |
with gr.Blocks(css=custom_css) as demo:
|
|
|
10 |
import requests
|
11 |
|
12 |
from envs import API, EVAL_REQUESTS_PATH, TOKEN, QUEUE_REPO
|
13 |
+
from utils import LLM_BENCHMARKS_ABOUT_TEXT, LLM_BENCHMARKS_SUBMIT_TEXT, custom_css, jsonl_to_dataframe
|
14 |
|
15 |
|
16 |
|
|
|
102 |
|
103 |
# Any pandas-compatible data
|
104 |
# persian_df = pd.read_json(str(abs_path / "leaderboard_persian.jsonl"))
|
105 |
+
persian_df = jsonl_to_dataframe(str(abs_path / "leaderboard_persian.jsonl"))
|
106 |
base_df = pd.read_json(str(abs_path / "leaderboard_base.json"))
|
107 |
|
108 |
with gr.Blocks(css=custom_css) as demo:
|
utils.py
CHANGED
@@ -138,13 +138,14 @@ LLM_BENCHMARKS_SUBMIT_TEXT = """## Submit your model
|
|
138 |
"""
|
139 |
|
140 |
|
141 |
-
def
|
142 |
data = []
|
143 |
-
with open(
|
144 |
-
for
|
145 |
-
|
146 |
-
|
147 |
-
|
148 |
-
|
149 |
-
|
|
|
150 |
return pd.DataFrame(data)
|
|
|
138 |
"""
|
139 |
|
140 |
|
141 |
+
def load_jsonl(input_file):
|
142 |
data = []
|
143 |
+
with open(input_file, 'r') as f:
|
144 |
+
for line in f:
|
145 |
+
data.append(json.loads(line))
|
146 |
+
return data
|
147 |
+
|
148 |
+
|
149 |
+
def jsonl_to_dataframe(input_file):
|
150 |
+
data = load_jsonl(input_file)
|
151 |
return pd.DataFrame(data)
|