5858 get_ip ,
5959 get_model_description_md ,
6060 enable_text ,
61+ show_vote_button ,
62+ dont_show_vote_button ,
6163)
6264from fastchat .serve .remote_logger import get_remote_logger
6365from fastchat .utils import (
@@ -241,6 +243,7 @@ def add_text(
241243 no_change_btn ,
242244 ]
243245 * 6
246+ + [dont_show_vote_button ]
244247 )
245248
246249 model_list = [states [i ].model_name for i in range (num_sides )]
@@ -290,6 +293,7 @@ def add_text(
290293 no_change_btn ,
291294 ]
292295 * 6
296+ + [dont_show_vote_button ]
293297 )
294298
295299 if text_flagged or nsfw_flag :
@@ -308,6 +312,7 @@ def add_text(
308312 no_change_btn ,
309313 ]
310314 * 6
315+ + [dont_show_vote_button ]
311316 )
312317
313318 text = text [:INPUT_CHAR_LEN_LIMIT ] # Hard cut-off
@@ -329,6 +334,7 @@ def add_text(
329334 disable_btn ,
330335 ]
331336 * 6
337+ + [show_vote_button ]
332338 )
333339
334340
@@ -353,6 +359,7 @@ def build_side_by_side_vision_ui_named(context: Context, random_questions=None):
353359 states = [gr .State () for _ in range (num_sides )]
354360 model_selectors = [None ] * num_sides
355361 chatbots = [None ] * num_sides
362+ show_vote_buttons = gr .State (True )
356363
357364 notice = gr .Markdown (notice_markdown , elem_id = "notice_markdown" )
358365
@@ -558,37 +565,37 @@ def build_side_by_side_vision_ui_named(context: Context, random_questions=None):
558565 multimodal_textbox .submit (
559566 add_text ,
560567 states + model_selectors + [multimodal_textbox , context_state ],
561- states + chatbots + [multimodal_textbox , textbox , send_btn ] + btn_list ,
568+ states + chatbots + [multimodal_textbox , textbox , send_btn ] + btn_list + [ show_vote_buttons ] ,
562569 ).then (set_invisible_image , [], [image_column ]).then (
563570 bot_response_multi ,
564571 states + [temperature , top_p , max_output_tokens ],
565572 states + chatbots + btn_list ,
566573 ).then (
567- flash_buttons , [], btn_list
574+ flash_buttons , [show_vote_buttons ], btn_list
568575 )
569576
570577 textbox .submit (
571578 add_text ,
572579 states + model_selectors + [textbox , context_state ],
573- states + chatbots + [multimodal_textbox , textbox , send_btn ] + btn_list ,
580+ states + chatbots + [multimodal_textbox , textbox , send_btn ] + btn_list + [ show_vote_buttons ] ,
574581 ).then (set_invisible_image , [], [image_column ]).then (
575582 bot_response_multi ,
576583 states + [temperature , top_p , max_output_tokens ],
577584 states + chatbots + btn_list ,
578585 ).then (
579- flash_buttons , [], btn_list
586+ flash_buttons , [show_vote_buttons ], btn_list
580587 )
581588
582589 send_btn .click (
583590 add_text ,
584591 states + model_selectors + [textbox , context_state ],
585- states + chatbots + [multimodal_textbox , textbox , send_btn ] + btn_list ,
592+ states + chatbots + [multimodal_textbox , textbox , send_btn ] + btn_list + [ show_vote_buttons ] ,
586593 ).then (set_invisible_image , [], [image_column ]).then (
587594 bot_response_multi ,
588595 states + [temperature , top_p , max_output_tokens ],
589596 states + chatbots + btn_list ,
590597 ).then (
591- flash_buttons , [], btn_list
598+ flash_buttons , [show_vote_buttons ], btn_list
592599 )
593600
594601 if random_questions :
0 commit comments