Skip to content

Commit 8664268

Browse files
Remove loading of Copilot Arena tab when env variable is not set (#3645)
1 parent 7a912c7 commit 8664268

File tree

2 files changed

+13
-16
lines changed

2 files changed

+13
-16
lines changed

fastchat/serve/monitor/copilot_arena.py

Lines changed: 0 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -7,12 +7,6 @@
77

88
copilot_arena_leaderboard_url = os.getenv("COPILOT_ARENA_LEADERBOARD_URL")
99

10-
if not copilot_arena_leaderboard_url:
11-
raise ValueError(
12-
"COPILOT_ARENA_LEADERBOARD_URL environment variable is not set. "
13-
"Please configure it to a valid URL."
14-
)
15-
1610

1711
def process_copilot_arena_leaderboard(leaderboard):
1812
leaderboard = leaderboard.copy().loc[leaderboard["visibility"] == "public"]
@@ -41,9 +35,6 @@ def process_copilot_arena_leaderboard(leaderboard):
4135

4236

4337
def build_copilot_arena_tab():
44-
if copilot_arena_leaderboard_url is None:
45-
print("Copilot Arena Leaderboard URL is not set. Skipping this leaderboard.")
46-
return
4738
response = requests.get(copilot_arena_leaderboard_url)
4839
if response.status_code == 200:
4940
leaderboard = pd.DataFrame(response.json()["elo_data"])

fastchat/serve/monitor/monitor.py

Lines changed: 13 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1034,15 +1034,21 @@ def build_leaderboard_tab(
10341034
build_full_leaderboard_tab(
10351035
elo_results_text, model_table_df, model_to_score
10361036
)
1037-
try:
1038-
with gr.Tab("Copilot Arena Leaderboard", id=5):
1039-
from fastchat.serve.monitor.copilot_arena import (
1040-
build_copilot_arena_tab,
1041-
)
10421037

1038+
from fastchat.serve.monitor.copilot_arena import (
1039+
build_copilot_arena_tab,
1040+
copilot_arena_leaderboard_url,
1041+
)
1042+
1043+
if copilot_arena_leaderboard_url:
1044+
with gr.Tab("Copilot Arena Leaderboard", id=5):
10431045
build_copilot_arena_tab()
1044-
except Exception as e:
1045-
print(f"Unable to build Copilot Arena's Leaderboard. Error: {e}")
1046+
else:
1047+
print(
1048+
"Unable to build Copilot Arena's Leaderboard. "
1049+
"COPILOT_ARENA_LEADERBOARD_URL environment variable is not set. "
1050+
"Please configure it to a valid URL."
1051+
)
10461052

10471053
if not show_plot:
10481054
gr.Markdown(

0 commit comments

Comments
 (0)