Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Remove loading of Copilot Arena tab when env variable is not set #3645

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 0 additions & 9 deletions fastchat/serve/monitor/copilot_arena.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,12 +7,6 @@

copilot_arena_leaderboard_url = os.getenv("COPILOT_ARENA_LEADERBOARD_URL")

if not copilot_arena_leaderboard_url:
raise ValueError(
"COPILOT_ARENA_LEADERBOARD_URL environment variable is not set. "
"Please configure it to a valid URL."
)


def process_copilot_arena_leaderboard(leaderboard):
leaderboard = leaderboard.copy().loc[leaderboard["visibility"] == "public"]
Expand Down Expand Up @@ -41,9 +35,6 @@ def process_copilot_arena_leaderboard(leaderboard):


def build_copilot_arena_tab():
if copilot_arena_leaderboard_url is None:
print("Copilot Arena Leaderboard URL is not set. Skipping this leaderboard.")
return
response = requests.get(copilot_arena_leaderboard_url)
if response.status_code == 200:
leaderboard = pd.DataFrame(response.json()["elo_data"])
Expand Down
20 changes: 13 additions & 7 deletions fastchat/serve/monitor/monitor.py
Original file line number Diff line number Diff line change
Expand Up @@ -1034,15 +1034,21 @@ def build_leaderboard_tab(
build_full_leaderboard_tab(
elo_results_text, model_table_df, model_to_score
)
try:
with gr.Tab("Copilot Arena Leaderboard", id=5):
from fastchat.serve.monitor.copilot_arena import (
build_copilot_arena_tab,
)

from fastchat.serve.monitor.copilot_arena import (
build_copilot_arena_tab,
copilot_arena_leaderboard_url,
)

if copilot_arena_leaderboard_url:
with gr.Tab("Copilot Arena Leaderboard", id=5):
build_copilot_arena_tab()
except Exception as e:
print(f"Unable to build Copilot Arena's Leaderboard. Error: {e}")
else:
print(
"Unable to build Copilot Arena's Leaderboard. "
"COPILOT_ARENA_LEADERBOARD_URL environment variable is not set. "
"Please configure it to a valid URL."
)

if not show_plot:
gr.Markdown(
Expand Down
Loading