Spaces:
Running
Running
Jae-Won Chung
commited on
Commit
•
a342695
1
Parent(s):
b10121d
Update Colosseum
Browse files
app.py
CHANGED
@@ -868,16 +868,7 @@ def on_load():
|
|
868 |
"""Intialize the dataframe, shuffle the model preference dropdown choices."""
|
869 |
dataframe = global_ltbm.set_filter_get_df()
|
870 |
dataframes = [global_tbm.set_filter_get_df() for global_tbm in global_tbms]
|
871 |
-
|
872 |
-
random.shuffle(available_models)
|
873 |
-
available_models.insert(0, RANDOM_MODEL_NAME)
|
874 |
-
return (
|
875 |
-
dataframe,
|
876 |
-
*dataframes,
|
877 |
-
gr.Dropdown.update(
|
878 |
-
choices=[model_name_to_user_pref[model] for model in available_models]
|
879 |
-
),
|
880 |
-
)
|
881 |
|
882 |
|
883 |
def add_prompt_disable_submit(prompt, history_a, history_b):
|
@@ -886,16 +877,15 @@ def add_prompt_disable_submit(prompt, history_a, history_b):
|
|
886 |
return [
|
887 |
gr.Textbox.update(value=" ", interactive=False),
|
888 |
gr.Button.update(interactive=False),
|
889 |
-
gr.Dropdown.update(interactive=False),
|
890 |
history_a + [[prompt, ""]],
|
891 |
history_b + [[prompt, ""]],
|
892 |
client,
|
893 |
]
|
894 |
|
895 |
|
896 |
-
def generate_responses(client: ControllerClient,
|
897 |
"""Generate responses for the two models."""
|
898 |
-
model_preference =
|
899 |
for resp_a, resp_b in itertools.zip_longest(
|
900 |
client.prompt(
|
901 |
prompt=history_a[-1][0], index=0, model_preference=model_preference
|
@@ -985,12 +975,6 @@ def play_again():
|
|
985 |
gr.Markdown.update(value="", visible=False), gr.Markdown.update(value="", visible=False),
|
986 |
# Hide energy vote buttons and message
|
987 |
gr.Button.update(visible=False), gr.Button.update(visible=False), gr.Markdown.update(visible=False),
|
988 |
-
# Enable model preference dropdown and shuffle choices
|
989 |
-
gr.Dropdown.update(
|
990 |
-
value=RANDOM_USER_PREFERENCE,
|
991 |
-
choices=[model_name_to_user_pref[model] for model in available_models],
|
992 |
-
interactive=True,
|
993 |
-
),
|
994 |
# Disable reset button
|
995 |
gr.Button.update(interactive=False, visible=False),
|
996 |
]
|
@@ -1026,14 +1010,6 @@ with gr.Blocks(css=custom_css) as block:
|
|
1026 |
gr.HTML("<h3 style='text-align: center'>The energy leaderboard is still available.</h3><br/>")
|
1027 |
gr.HTML(COLOSSUMM_YOUTUBE_DEMO_EMBED_HTML)
|
1028 |
|
1029 |
-
with gr.Row():
|
1030 |
-
model_preference_dropdown = gr.Dropdown(
|
1031 |
-
value=RANDOM_USER_PREFERENCE,
|
1032 |
-
label="Prefer a specific model?",
|
1033 |
-
interactive=COLOSSEUM_UP,
|
1034 |
-
elem_classes=None if COLOSSEUM_UP else ["greyed-out"],
|
1035 |
-
)
|
1036 |
-
|
1037 |
with gr.Group():
|
1038 |
with gr.Row():
|
1039 |
prompt_input = gr.Textbox(
|
@@ -1123,12 +1099,12 @@ with gr.Blocks(css=custom_css) as block:
|
|
1123 |
|
1124 |
|
1125 |
(prompt_input
|
1126 |
-
.submit(add_prompt_disable_submit, [prompt_input, *chatbots], [prompt_input, prompt_submit_btn,
|
1127 |
-
.then(generate_responses, [controller_client,
|
1128 |
.then(enable_interact(2), None, resp_vote_btn_list, queue=False))
|
1129 |
(prompt_submit_btn
|
1130 |
-
.click(add_prompt_disable_submit, [prompt_input, *chatbots], [prompt_input, prompt_submit_btn,
|
1131 |
-
.then(generate_responses, [controller_client,
|
1132 |
.then(enable_interact(2), None, resp_vote_btn_list, queue=False))
|
1133 |
|
1134 |
left_resp_vote_btn.click(
|
@@ -1161,7 +1137,7 @@ with gr.Blocks(css=custom_css) as block:
|
|
1161 |
.click(
|
1162 |
play_again,
|
1163 |
None,
|
1164 |
-
[*chatbots, prompt_input, prompt_submit_btn, *masked_model_names, *energy_vote_btn_list, energy_comparison_message,
|
1165 |
queue=False,
|
1166 |
)
|
1167 |
.then(None, _js=focus_prompt_input_js, queue=False))
|
@@ -1285,7 +1261,7 @@ with gr.Blocks(css=custom_css) as block:
|
|
1285 |
# Load the table on page load.
|
1286 |
block.load(
|
1287 |
on_load,
|
1288 |
-
outputs=[dataframe, *dataframes
|
1289 |
queue=False,
|
1290 |
)
|
1291 |
|
|
|
868 |
"""Intialize the dataframe, shuffle the model preference dropdown choices."""
|
869 |
dataframe = global_ltbm.set_filter_get_df()
|
870 |
dataframes = [global_tbm.set_filter_get_df() for global_tbm in global_tbms]
|
871 |
+
return dataframe, *dataframes
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
872 |
|
873 |
|
874 |
def add_prompt_disable_submit(prompt, history_a, history_b):
|
|
|
877 |
return [
|
878 |
gr.Textbox.update(value=" ", interactive=False),
|
879 |
gr.Button.update(interactive=False),
|
|
|
880 |
history_a + [[prompt, ""]],
|
881 |
history_b + [[prompt, ""]],
|
882 |
client,
|
883 |
]
|
884 |
|
885 |
|
886 |
+
def generate_responses(client: ControllerClient, history_a, history_b):
|
887 |
"""Generate responses for the two models."""
|
888 |
+
model_preference = RANDOM_MODEL_NAME
|
889 |
for resp_a, resp_b in itertools.zip_longest(
|
890 |
client.prompt(
|
891 |
prompt=history_a[-1][0], index=0, model_preference=model_preference
|
|
|
975 |
gr.Markdown.update(value="", visible=False), gr.Markdown.update(value="", visible=False),
|
976 |
# Hide energy vote buttons and message
|
977 |
gr.Button.update(visible=False), gr.Button.update(visible=False), gr.Markdown.update(visible=False),
|
|
|
|
|
|
|
|
|
|
|
|
|
978 |
# Disable reset button
|
979 |
gr.Button.update(interactive=False, visible=False),
|
980 |
]
|
|
|
1010 |
gr.HTML("<h3 style='text-align: center'>The energy leaderboard is still available.</h3><br/>")
|
1011 |
gr.HTML(COLOSSUMM_YOUTUBE_DEMO_EMBED_HTML)
|
1012 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1013 |
with gr.Group():
|
1014 |
with gr.Row():
|
1015 |
prompt_input = gr.Textbox(
|
|
|
1099 |
|
1100 |
|
1101 |
(prompt_input
|
1102 |
+
.submit(add_prompt_disable_submit, [prompt_input, *chatbots], [prompt_input, prompt_submit_btn, *chatbots, controller_client], queue=False)
|
1103 |
+
.then(generate_responses, [controller_client, *chatbots], [*chatbots], queue=True, show_progress="hidden")
|
1104 |
.then(enable_interact(2), None, resp_vote_btn_list, queue=False))
|
1105 |
(prompt_submit_btn
|
1106 |
+
.click(add_prompt_disable_submit, [prompt_input, *chatbots], [prompt_input, prompt_submit_btn, *chatbots, controller_client], queue=False)
|
1107 |
+
.then(generate_responses, [controller_client, *chatbots], [*chatbots], queue=True, show_progress="hidden")
|
1108 |
.then(enable_interact(2), None, resp_vote_btn_list, queue=False))
|
1109 |
|
1110 |
left_resp_vote_btn.click(
|
|
|
1137 |
.click(
|
1138 |
play_again,
|
1139 |
None,
|
1140 |
+
[*chatbots, prompt_input, prompt_submit_btn, *masked_model_names, *energy_vote_btn_list, energy_comparison_message, play_again_btn],
|
1141 |
queue=False,
|
1142 |
)
|
1143 |
.then(None, _js=focus_prompt_input_js, queue=False))
|
|
|
1261 |
# Load the table on page load.
|
1262 |
block.load(
|
1263 |
on_load,
|
1264 |
+
outputs=[dataframe, *dataframes],
|
1265 |
queue=False,
|
1266 |
)
|
1267 |
|