Spaces:
Running
Running
fix
Browse files
app.py
CHANGED
|
@@ -18,7 +18,7 @@ import pandas as pd
|
|
| 18 |
from datetime import datetime
|
| 19 |
from github import Github
|
| 20 |
from gradio_leaderboard import Leaderboard
|
| 21 |
-
from huggingface_hub import upload_file, hf_hub_download,
|
| 22 |
from openai import OpenAI
|
| 23 |
|
| 24 |
# Load environment variables
|
|
@@ -321,7 +321,7 @@ def save_content_to_hf(vote_data, repo_name, folder_name, file_name):
|
|
| 321 |
filename = f"{folder_name}/{file_name}.json"
|
| 322 |
|
| 323 |
# Ensure the user is authenticated with HF
|
| 324 |
-
token =
|
| 325 |
if token is None:
|
| 326 |
raise ValueError("Please log in to Hugging Face using `huggingface-cli login`.")
|
| 327 |
|
|
@@ -331,7 +331,7 @@ def save_content_to_hf(vote_data, repo_name, folder_name, file_name):
|
|
| 331 |
path_in_repo=filename,
|
| 332 |
repo_id=repo_name,
|
| 333 |
repo_type="dataset",
|
| 334 |
-
|
| 335 |
)
|
| 336 |
|
| 337 |
|
|
@@ -605,7 +605,7 @@ def get_leaderboard_data(vote_entry=None, use_cache=True):
|
|
| 605 |
path_in_repo=f"{year}.json",
|
| 606 |
repo_id="SWE-Arena/model_leaderboards",
|
| 607 |
repo_type="dataset",
|
| 608 |
-
|
| 609 |
)
|
| 610 |
except Exception as e:
|
| 611 |
print(f"Failed to save leaderboard cache: {e}")
|
|
@@ -1104,7 +1104,7 @@ with gr.Blocks(js=clickable_links_js) as app:
|
|
| 1104 |
try:
|
| 1105 |
# Use Hugging Face OAuth to initiate login
|
| 1106 |
HfApi()
|
| 1107 |
-
token =
|
| 1108 |
if not token:
|
| 1109 |
raise Exception("Authentication token not found.")
|
| 1110 |
|
|
|
|
| 18 |
from datetime import datetime
|
| 19 |
from github import Github
|
| 20 |
from gradio_leaderboard import Leaderboard
|
| 21 |
+
from huggingface_hub import upload_file, hf_hub_download, HfApi
|
| 22 |
from openai import OpenAI
|
| 23 |
|
| 24 |
# Load environment variables
|
|
|
|
| 321 |
filename = f"{folder_name}/{file_name}.json"
|
| 322 |
|
| 323 |
# Ensure the user is authenticated with HF
|
| 324 |
+
token = HfApi().token
|
| 325 |
if token is None:
|
| 326 |
raise ValueError("Please log in to Hugging Face using `huggingface-cli login`.")
|
| 327 |
|
|
|
|
| 331 |
path_in_repo=filename,
|
| 332 |
repo_id=repo_name,
|
| 333 |
repo_type="dataset",
|
| 334 |
+
token=token,
|
| 335 |
)
|
| 336 |
|
| 337 |
|
|
|
|
| 605 |
path_in_repo=f"{year}.json",
|
| 606 |
repo_id="SWE-Arena/model_leaderboards",
|
| 607 |
repo_type="dataset",
|
| 608 |
+
token=HfApi().token,
|
| 609 |
)
|
| 610 |
except Exception as e:
|
| 611 |
print(f"Failed to save leaderboard cache: {e}")
|
|
|
|
| 1104 |
try:
|
| 1105 |
# Use Hugging Face OAuth to initiate login
|
| 1106 |
HfApi()
|
| 1107 |
+
token = HfApi().token
|
| 1108 |
if not token:
|
| 1109 |
raise Exception("Authentication token not found.")
|
| 1110 |
|