Skip to content

Commit add072b

Browse files
committed
Address comments
1 parent 5b1fa5e commit add072b

File tree

1 file changed

+11
-9
lines changed

1 file changed

+11
-9
lines changed

fastchat/serve/gradio_block_arena_named.py

Lines changed: 11 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,8 @@
2929
get_ip,
3030
get_model_description_md,
3131
_write_to_json,
32+
show_vote_button,
33+
dont_show_vote_button,
3234
)
3335
from fastchat.serve.moderation.moderator import AzureAndOpenAIContentModerator
3436
from fastchat.serve.remote_logger import get_remote_logger
@@ -178,7 +180,7 @@ def add_text(
178180
no_change_btn,
179181
]
180182
* 6
181-
+ [True]
183+
+ [dont_show_vote_button]
182184
)
183185

184186
model_list = [states[i].model_name for i in range(num_sides)]
@@ -197,7 +199,7 @@ def add_text(
197199
no_change_btn,
198200
]
199201
* 6
200-
+ [True]
202+
+ [dont_show_vote_button]
201203
)
202204

203205
conv = states[0].conv
@@ -213,7 +215,7 @@ def add_text(
213215
no_change_btn,
214216
]
215217
* 6
216-
+ [True]
218+
+ [dont_show_vote_button]
217219
)
218220

219221
text = text[:INPUT_CHAR_LEN_LIMIT] # Hard cut-off
@@ -230,7 +232,7 @@ def add_text(
230232
disable_btn,
231233
]
232234
* 6
233-
+ [False]
235+
+ [show_vote_button]
234236
)
235237

236238

@@ -378,7 +380,7 @@ def build_side_by_side_ui_named(models):
378380
states = [gr.State() for _ in range(num_sides)]
379381
model_selectors = [None] * num_sides
380382
chatbots = [None] * num_sides
381-
dont_show_vote_buttons = gr.State(False)
383+
show_vote_buttons = gr.State(True)
382384

383385
notice = gr.Markdown(notice_markdown, elem_id="notice_markdown")
384386

@@ -540,24 +542,24 @@ def build_side_by_side_ui_named(models):
540542
textbox.submit(
541543
add_text,
542544
states + model_selectors + [textbox],
543-
states + chatbots + [textbox] + btn_list + [dont_show_vote_buttons],
545+
states + chatbots + [textbox] + btn_list + [show_vote_buttons],
544546
).then(
545547
bot_response_multi,
546548
states + [temperature, top_p, max_output_tokens],
547549
states + chatbots + btn_list,
548550
).then(
549-
flash_buttons, [dont_show_vote_buttons], btn_list
551+
flash_buttons, [show_vote_buttons], btn_list
550552
)
551553
send_btn.click(
552554
add_text,
553555
states + model_selectors + [textbox],
554-
states + chatbots + [textbox] + btn_list + [dont_show_vote_buttons],
556+
states + chatbots + [textbox] + btn_list + [show_vote_buttons],
555557
).then(
556558
bot_response_multi,
557559
states + [temperature, top_p, max_output_tokens],
558560
states + chatbots + btn_list,
559561
).then(
560-
flash_buttons, [dont_show_vote_buttons], btn_list
562+
flash_buttons, [show_vote_buttons], btn_list
561563
)
562564

563565
return states + model_selectors

0 commit comments

Comments
 (0)