Spaces:
Sleeping
Sleeping
refine
Browse files- app.py +7 -7
- model_metadata.jsonl → model_data.jsonl +0 -0
app.py
CHANGED
|
@@ -40,7 +40,7 @@ SHOW_HINT_STRING = True # Set to False to hide the hint string altogether
|
|
| 40 |
HINT_STRING = "Once signed in, your votes will be recorded securely."
|
| 41 |
|
| 42 |
# Load model metadata
|
| 43 |
-
model_metadata = pd.read_json("
|
| 44 |
|
| 45 |
# Create a dictionary mapping model names to their context lengths
|
| 46 |
model_context_window = model_metadata.set_index("model_name")[
|
|
@@ -350,7 +350,7 @@ def is_file_within_time_frame(file_path, days):
|
|
| 350 |
return False
|
| 351 |
|
| 352 |
|
| 353 |
-
def load_content_from_hf(repo_name="SWE-Arena/
|
| 354 |
"""
|
| 355 |
Read feedback content from a Hugging Face repository within the last LEADERBOARD_UPDATE_TIME_FRAME_DAYS days.
|
| 356 |
|
|
@@ -387,7 +387,7 @@ def get_leaderboard_data(vote_entry=None, use_cache=True):
|
|
| 387 |
if use_cache:
|
| 388 |
try:
|
| 389 |
cached_path = hf_hub_download(
|
| 390 |
-
repo_id="SWE-Arena/
|
| 391 |
filename="swe-model-arena.json",
|
| 392 |
repo_type="dataset",
|
| 393 |
)
|
|
@@ -436,7 +436,7 @@ def get_leaderboard_data(vote_entry=None, use_cache=True):
|
|
| 436 |
)
|
| 437 |
|
| 438 |
# Load conversation data from the Hugging Face repository
|
| 439 |
-
conversation_data = load_content_from_hf("SWE-Arena/
|
| 440 |
conversation_df = pd.DataFrame(conversation_data)
|
| 441 |
|
| 442 |
# Merge vote data with conversation data
|
|
@@ -614,7 +614,7 @@ def get_leaderboard_data(vote_entry=None, use_cache=True):
|
|
| 614 |
upload_file(
|
| 615 |
path_or_fileobj=file_like_object,
|
| 616 |
path_in_repo="swe-model-arena.json",
|
| 617 |
-
repo_id="SWE-Arena/
|
| 618 |
repo_type="dataset",
|
| 619 |
token=HfApi().token,
|
| 620 |
)
|
|
@@ -1462,7 +1462,7 @@ with gr.Blocks(js=clickable_links_js) as app:
|
|
| 1462 |
|
| 1463 |
# Save feedback back to the Hugging Face dataset
|
| 1464 |
save_content_to_hf(
|
| 1465 |
-
vote_entry, "SWE-Arena/
|
| 1466 |
)
|
| 1467 |
|
| 1468 |
conversation_state["right_chat"][0]["content"] = conversation_state[
|
|
@@ -1475,7 +1475,7 @@ with gr.Blocks(js=clickable_links_js) as app:
|
|
| 1475 |
# Save conversations back to the Hugging Face dataset
|
| 1476 |
save_content_to_hf(
|
| 1477 |
conversation_state,
|
| 1478 |
-
"SWE-Arena/
|
| 1479 |
file_name,
|
| 1480 |
token,
|
| 1481 |
)
|
|
|
|
| 40 |
HINT_STRING = "Once signed in, your votes will be recorded securely."
|
| 41 |
|
| 42 |
# Load model metadata
|
| 43 |
+
model_metadata = pd.read_json("model_data.jsonl", lines=True)
|
| 44 |
|
| 45 |
# Create a dictionary mapping model names to their context lengths
|
| 46 |
model_context_window = model_metadata.set_index("model_name")[
|
|
|
|
| 350 |
return False
|
| 351 |
|
| 352 |
|
| 353 |
+
def load_content_from_hf(repo_name="SWE-Arena/vote_data"):
|
| 354 |
"""
|
| 355 |
Read feedback content from a Hugging Face repository within the last LEADERBOARD_UPDATE_TIME_FRAME_DAYS days.
|
| 356 |
|
|
|
|
| 387 |
if use_cache:
|
| 388 |
try:
|
| 389 |
cached_path = hf_hub_download(
|
| 390 |
+
repo_id="SWE-Arena/leaderboard_data",
|
| 391 |
filename="swe-model-arena.json",
|
| 392 |
repo_type="dataset",
|
| 393 |
)
|
|
|
|
| 436 |
)
|
| 437 |
|
| 438 |
# Load conversation data from the Hugging Face repository
|
| 439 |
+
conversation_data = load_content_from_hf("SWE-Arena/conversation_data")
|
| 440 |
conversation_df = pd.DataFrame(conversation_data)
|
| 441 |
|
| 442 |
# Merge vote data with conversation data
|
|
|
|
| 614 |
upload_file(
|
| 615 |
path_or_fileobj=file_like_object,
|
| 616 |
path_in_repo="swe-model-arena.json",
|
| 617 |
+
repo_id="SWE-Arena/leaderboard_data",
|
| 618 |
repo_type="dataset",
|
| 619 |
token=HfApi().token,
|
| 620 |
)
|
|
|
|
| 1462 |
|
| 1463 |
# Save feedback back to the Hugging Face dataset
|
| 1464 |
save_content_to_hf(
|
| 1465 |
+
vote_entry, "SWE-Arena/vote_data", file_name, token
|
| 1466 |
)
|
| 1467 |
|
| 1468 |
conversation_state["right_chat"][0]["content"] = conversation_state[
|
|
|
|
| 1475 |
# Save conversations back to the Hugging Face dataset
|
| 1476 |
save_content_to_hf(
|
| 1477 |
conversation_state,
|
| 1478 |
+
"SWE-Arena/conversation_data",
|
| 1479 |
file_name,
|
| 1480 |
token,
|
| 1481 |
)
|
model_metadata.jsonl → model_data.jsonl
RENAMED
|
File without changes
|