from .utils import * from .vote_utils import ( upvote_last_response_ig as upvote_last_response, downvote_last_response_ig as downvote_last_response, flag_last_response_ig as flag_last_response, leftvote_last_response_igm as leftvote_last_response, left1vote_last_response_igm as left1vote_last_response, rightvote_last_response_igm as rightvote_last_response, right1vote_last_response_igm as right1vote_last_response, tievote_last_response_igm as tievote_last_response, bothbad_vote_last_response_igm as bothbad_vote_last_response, share_click_igm as share_click, generate_ig, generate_ig_museum, generate_igm, generate_igm_museum, generate_igm_annoy, generate_igm_annoy_museum, generate_igm_cache_annoy, share_js ) from .Ksort import ( add_foreground, reset_level, reset_rank, revote_windows, submit_response_igm, submit_response_rank_igm, reset_submit, clear_rank, reset_mode, reset_chatbot, reset_btn_rank, reset_vote_text, text_response_rank_igm, check_textbox, ) from functools import partial from .upload import get_random_mscoco_prompt from serve.constants import SSH_SERVER, SSH_PORT, SSH_USER, SSH_PASSWORD from serve.upload import get_random_mscoco_prompt, create_ssh_client from serve.update_skill import create_ssh_skill_client from model.matchmaker import create_ssh_matchmaker_client def set_ssh(): create_ssh_client(SSH_SERVER, SSH_PORT, SSH_USER, SSH_PASSWORD) create_ssh_skill_client(SSH_SERVER, SSH_PORT, SSH_USER, SSH_PASSWORD) create_ssh_matchmaker_client(SSH_SERVER, SSH_PORT, SSH_USER, SSH_PASSWORD) def build_side_by_side_ui_anony(models): notice_markdown = """ # ⚔️ K-Sort Arena (Text-to-Image Generation) ⚔️ ## 📜 Rules - Input a prompt for four anonymized models (e.g., SD, SDXL, OpenJourney for Text-guided Image Generation) and vote on their outputs. - Two voting modes available: Rank Mode and Best Mode. Switch freely between modes. Please note that ties are always allowed. In ranking mode, users can input rankings like 1 3 3 1. Any invalid rankings, such as 1 4 4 1, will be automatically corrected during post-processing. - Users are encouraged to make evaluations based on subjective preferences. Evaluation criteria: Alignment (50%) + Aesthetics (50%). - Alignment includes: Entity Matching (30%) + Style Matching (20%); - Aesthetics includes: Photorealism (30%) + Light and Shadow (10%) + Absence of Artifacts (10%). ## 👇 Generating now! - Note: Due to the API's image safety checks, errors may occur. If this happens, please re-enter a different prompt. - At times, high API concurrency can cause congestion, potentially resulting in a generation time of up to 1.5 minutes per image. Thank you for your patience. """ model_list = models.model_ig_list state0 = gr.State() state1 = gr.State() state2 = gr.State() state3 = gr.State() gen_func = partial(generate_igm_annoy, models.generate_image_ig_parallel_anony) gen_cache_func = partial(generate_igm_cache_annoy, models.generate_image_ig_cache_anony) # gen_func_random = partial(generate_igm_annoy_museum, models.generate_image_ig_museum_parallel_anony) gr.Markdown(notice_markdown, elem_id="notice_markdown") with gr.Group(elem_id="share-region-anony"): with gr.Accordion("🔍 Expand to see all Arena players", open=False): model_description_md = get_model_description_md(model_list) gr.Markdown(model_description_md, elem_id="model_description_markdown") with gr.Row(): with gr.Column(): chatbot_left = gr.Image(width=512, label = "Model A") with gr.Column(): chatbot_left1 = gr.Image(width=512, label = "Model B") with gr.Column(): chatbot_right = gr.Image(width=512, label = "Model C") with gr.Column(): chatbot_right1 = gr.Image(width=512, label = "Model D") with gr.Row(): with gr.Column(): model_selector_left = gr.Markdown("", visible=False) with gr.Column(): model_selector_left1 = gr.Markdown("", visible=False) with gr.Column(): model_selector_right = gr.Markdown("", visible=False) with gr.Column(): model_selector_right1 = gr.Markdown("", visible=False) with gr.Row(): slow_warning = gr.Markdown("", elem_id="notice_markdown") with gr.Row(elem_classes="row"): with gr.Column(scale=1, min_width=10): leftvote_btn = gr.Button( value="A is Best", visible=False, interactive=False, elem_id="btncolor1", elem_classes="best-button" ) with gr.Column(scale=1, min_width=10): left1vote_btn = gr.Button( value="B is Best", visible=False, interactive=False, elem_id="btncolor1", elem_classes="best-button" ) with gr.Column(scale=1, min_width=10): rightvote_btn = gr.Button( value="C is Best", visible=False, interactive=False, elem_id="btncolor1", elem_classes="best-button" ) with gr.Column(scale=1, min_width=10): right1vote_btn = gr.Button( value="D is Best", visible=False, interactive=False, elem_id="btncolor1", elem_classes="best-button" ) with gr.Column(scale=1, min_width=10): tie_btn = gr.Button( value="🤝 Tie", visible=False, interactive=False, elem_id="btncolor2", elem_classes="best-button" ) with gr.Row(): with gr.Blocks(): with gr.Row(): with gr.Column(scale=1, min_width=10): A1_btn = gr.Button( value="1", visible=False, interactive=False, elem_id="btncolor1", elem_classes="custom-button" ) with gr.Column(scale=1, min_width=10): A2_btn = gr.Button( value="2", visible=False, interactive=False, elem_id="btncolor2", elem_classes="custom-button" ) with gr.Column(scale=1, min_width=10): A3_btn = gr.Button( value="3", visible=False, interactive=False, elem_id="btncolor3", elem_classes="custom-button" ) with gr.Column(scale=1, min_width=10): A4_btn = gr.Button( value="4", visible=False, interactive=False, elem_id="btncolor4", elem_classes="custom-button" ) with gr.Blocks(): with gr.Row(): with gr.Column(scale=1, min_width=10): B1_btn = gr.Button( value="1", visible=False, interactive=False, elem_id="btncolor1", elem_classes="custom-button" ) with gr.Column(scale=1, min_width=10): B2_btn = gr.Button( value="2", visible=False, interactive=False, elem_id="btncolor2", elem_classes="custom-button" ) with gr.Column(scale=1, min_width=10): B3_btn = gr.Button( value="3", visible=False, interactive=False, elem_id="btncolor3", elem_classes="custom-button" ) with gr.Column(scale=1, min_width=10): B4_btn = gr.Button( value="4", visible=False, interactive=False, elem_id="btncolor4", elem_classes="custom-button" ) with gr.Blocks(): with gr.Row(): with gr.Column(scale=1, min_width=10): C1_btn = gr.Button( value="1", visible=False, interactive=False, elem_id="btncolor1", elem_classes="custom-button" ) with gr.Column(scale=1, min_width=10): C2_btn = gr.Button( value="2", visible=False, interactive=False, elem_id="btncolor2", elem_classes="custom-button" ) with gr.Column(scale=1, min_width=10): C3_btn = gr.Button( value="3", visible=False, interactive=False, elem_id="btncolor3", elem_classes="custom-button" ) with gr.Column(scale=1, min_width=10): C4_btn = gr.Button( value="4", visible=False, interactive=False, elem_id="btncolor4", elem_classes="custom-button" ) with gr.Blocks(): with gr.Row(): with gr.Column(scale=1, min_width=10): D1_btn = gr.Button( value="1", visible=False, interactive=False, elem_id="btncolor1", elem_classes="custom-button" ) with gr.Column(scale=1, min_width=10): D2_btn = gr.Button( value="2", visible=False, interactive=False, elem_id="btncolor2", elem_classes="custom-button" ) with gr.Column(scale=1, min_width=10): D3_btn = gr.Button( value="3", visible=False, interactive=False, elem_id="btncolor3", elem_classes="custom-button" ) with gr.Column(scale=1, min_width=10): D4_btn = gr.Button( value="4", visible=False, interactive=False, elem_id="btncolor4", elem_classes="custom-button" ) with gr.Row(): vote_textbox = gr.Textbox( show_label=False, placeholder="👉 Enter your rank (you can use buttons above, or directly type here, e.g. 1 2 3 4)", container=True, elem_id="input_box", visible=False, ) vote_submit_btn = gr.Button(value="Submit", visible=False, interactive=False, variant="primary", scale=0, elem_id="btnpink", elem_classes="submit-button") vote_mode_btn = gr.Button(value="🔄 Mode", visible=False, interactive=False, variant="primary", scale=0, elem_id="btnpink", elem_classes="submit-button") with gr.Row(): textbox = gr.Textbox( show_label=False, placeholder="👉 Enter your prompt and press ENTER", container=True, elem_id="input_box", ) # send_btn = gr.Button(value="Send", variant="primary", scale=0, elem_id="btnblue", elem_classes="send-button") # draw_btn = gr.Button(value="🎲 Random sample", variant="primary", scale=0, elem_id="btnblue", elem_classes="send-button") send_btn = gr.Button(value="Send", variant="primary", scale=0, elem_id="btnblue") draw_btn = gr.Button(value="🎲 Random Prompt", variant="primary", scale=0, elem_id="btnblue") with gr.Row(): cache_btn = gr.Button(value="🎲 Random Sample", interactive=True) with gr.Row(): clear_btn = gr.Button(value="🎲 New Round", interactive=False) # regenerate_btn = gr.Button(value="🔄 Regenerate", interactive=False) # share_btn = gr.Button(value="📷 Share") with gr.Blocks(): with gr.Row(elem_id="centered-text"): # user_info = gr.Markdown("User information (to appear on the contributor leaderboard)", visible=True, elem_id="centered-text") #, elem_id="centered-text" # with gr.Blocks(): # name = gr.Markdown("Name", visible=True) user_name = gr.Textbox(show_label=False,placeholder="👉 Enter your name (optional)", elem_classes="custom-width") # with gr.Blocks(): # institution = gr.Markdown("Institution", visible=True) user_institution = gr.Textbox(show_label=False,placeholder="👉 Enter your affiliation (optional)", elem_classes="custom-width") #gr.Markdown(acknowledgment_md, elem_id="ack_markdown") dummy_img_output = gr.Image(width=512, visible=False) gr.Examples( examples=[["A train crossing a bridge that is going over a body of water.", os.path.join("./examples", "example1.jpg")], ["The man in the business suit wears a striped blue and white tie.", os.path.join("./examples", "example2.jpg")], ["A skier stands on a small ledge in the snow.",os.path.join("./examples", "example3.jpg")], ["The bathroom with green tile and a red shower curtain.", os.path.join("./examples", "example4.jpg")]], inputs = [textbox, dummy_img_output]) order_btn_list = [textbox, send_btn, draw_btn, cache_btn, clear_btn] vote_order_list = [leftvote_btn, left1vote_btn, rightvote_btn, right1vote_btn, tie_btn, \ A1_btn, A2_btn, A3_btn, A4_btn, B1_btn, B2_btn, B3_btn, B4_btn, C1_btn, C2_btn, C3_btn, C4_btn, D1_btn, D2_btn, D3_btn, D4_btn, \ vote_textbox, vote_submit_btn, vote_mode_btn] generate_ig0 = gr.Image(width=512, label = "generate A", visible=False, interactive=False) generate_ig1 = gr.Image(width=512, label = "generate B", visible=False, interactive=False) generate_ig2 = gr.Image(width=512, label = "generate C", visible=False, interactive=False) generate_ig3 = gr.Image(width=512, label = "generate D", visible=False, interactive=False) dummy_left_model = gr.State("") dummy_left1_model = gr.State("") dummy_right_model = gr.State("") dummy_right1_model = gr.State("") ig_rank = [None, None, None, None] bastA_rank = [0, 3, 3, 3] bastB_rank = [3, 0, 3, 3] bastC_rank = [3, 3, 0, 3] bastD_rank = [3, 3, 3, 0] tie_rank = [0, 0, 0, 0] bad_rank = [3, 3, 3, 3] rank = gr.State(ig_rank) rankA = gr.State(bastA_rank) rankB = gr.State(bastB_rank) rankC = gr.State(bastC_rank) rankD = gr.State(bastD_rank) rankTie = gr.State(tie_rank) rankBad = gr.State(bad_rank) Top1_text = gr.Textbox(value="Top 1", visible=False, interactive=False) Top2_text = gr.Textbox(value="Top 2", visible=False, interactive=False) Top3_text = gr.Textbox(value="Top 3", visible=False, interactive=False) Top4_text = gr.Textbox(value="Top 4", visible=False, interactive=False) window1_text = gr.Textbox(value="Model A", visible=False, interactive=False) window2_text = gr.Textbox(value="Model B", visible=False, interactive=False) window3_text = gr.Textbox(value="Model C", visible=False, interactive=False) window4_text = gr.Textbox(value="Model D", visible=False, interactive=False) vote_level = gr.Number(value=0, visible=False, interactive=False) # Top1_btn.click(reset_level, inputs=[Top1_text], outputs=[vote_level]) # Top2_btn.click(reset_level, inputs=[Top2_text], outputs=[vote_level]) # Top3_btn.click(reset_level, inputs=[Top3_text], outputs=[vote_level]) # Top4_btn.click(reset_level, inputs=[Top4_text], outputs=[vote_level]) vote_mode = gr.Textbox(value="Rank", visible=False, interactive=False) right_vote_text = gr.Textbox(value="wrong", visible=False, interactive=False) cache_mode = gr.Textbox(value="True", visible=False, interactive=False) textbox.submit( disable_order_buttons, inputs=[textbox], outputs=order_btn_list ).then( gen_func, inputs=[state0, state1, state2, state3, textbox, model_selector_left, model_selector_left1, model_selector_right, model_selector_right1], outputs=[state0, state1, state2, state3, generate_ig0, generate_ig1, generate_ig2, generate_ig3, chatbot_left, chatbot_left1, chatbot_right, chatbot_right1, \ model_selector_left, model_selector_left1, model_selector_right, model_selector_right1], api_name="submit_btn_annony" ).then( enable_vote_mode_buttons, inputs=[vote_mode, textbox], outputs=vote_order_list ) send_btn.click( disable_order_buttons, inputs=[textbox], outputs=order_btn_list ).then( gen_func, inputs=[state0, state1, state2, state3, textbox, model_selector_left, model_selector_left1, model_selector_right, model_selector_right1], outputs=[state0, state1, state2, state3, generate_ig0, generate_ig1, generate_ig2, generate_ig3, chatbot_left, chatbot_left1, chatbot_right, chatbot_right1, \ model_selector_left, model_selector_left1, model_selector_right, model_selector_right1], api_name="send_btn_annony" ).then( enable_vote_mode_buttons, inputs=[vote_mode, textbox], outputs=vote_order_list ) cache_btn.click( disable_order_buttons, inputs=[textbox, cache_mode], outputs=order_btn_list ).then( gen_cache_func, inputs=[state0, state1, state2, state3, model_selector_left, model_selector_left1, model_selector_right, model_selector_right1], outputs=[state0, state1, state2, state3, generate_ig0, generate_ig1, generate_ig2, generate_ig3, chatbot_left, chatbot_left1, chatbot_right, chatbot_right1, \ model_selector_left, model_selector_left1, model_selector_right, model_selector_right1, textbox], api_name="send_btn_annony" ).then( enable_vote_mode_buttons, inputs=[vote_mode, textbox], outputs=vote_order_list ) draw_btn.click( get_random_mscoco_prompt, inputs=None, outputs=[textbox], api_name="draw_btn_annony" ) clear_btn.click( clear_history_side_by_side_anony, inputs=None, outputs=[state0, state1, state2, state3, textbox, vote_textbox, chatbot_left, chatbot_left1, chatbot_right, chatbot_right1, \ model_selector_left, model_selector_left1, model_selector_right, model_selector_right1], api_name="clear_btn_annony" ).then( enable_order_buttons, inputs=None, outputs=order_btn_list ).then( clear_rank, inputs=[rank, vote_level], outputs=[rank, vote_level] ).then( disable_vote_mode_buttons, inputs=None, outputs=vote_order_list ) # regenerate_btn.click( # gen_func, # inputs=[state0, state1, state2, state3, textbox, model_selector_left, model_selector_left1, model_selector_right, model_selector_right1], # outputs=[state0, state1, state2, state3, chatbot_left, chatbot_left1, chatbot_right, chatbot_right1, \ # model_selector_left, model_selector_left1, model_selector_right, model_selector_right1], # api_name="regenerate_btn_annony" # ).then( # enable_best_buttons, # inputs=None, # outputs=btn_list # ) vote_mode_btn.click( reset_chatbot, inputs=[vote_mode, generate_ig0, generate_ig1, generate_ig2, generate_ig3], outputs=[chatbot_left, chatbot_left1, chatbot_right, chatbot_right1] ).then( reset_mode, inputs=[vote_mode], outputs=[leftvote_btn, left1vote_btn, rightvote_btn, right1vote_btn, tie_btn, \ A1_btn, A2_btn, A3_btn, A4_btn, B1_btn, B2_btn, B3_btn, B4_btn, C1_btn, C2_btn, C3_btn, C4_btn, D1_btn, D2_btn, D3_btn, D4_btn, \ vote_textbox, vote_submit_btn, vote_mode_btn, vote_mode] ) vote_textbox.submit( disable_vote, inputs=None, outputs=[vote_submit_btn, vote_mode_btn, \ A1_btn, A2_btn, A3_btn, A4_btn, B1_btn, B2_btn, B3_btn, B4_btn, C1_btn, C2_btn, C3_btn, C4_btn, D1_btn, D2_btn, D3_btn, D4_btn] ).then( text_response_rank_igm, inputs=[generate_ig0, generate_ig1, generate_ig2, generate_ig3, Top1_text, Top2_text, Top3_text, Top4_text, vote_textbox], outputs=[chatbot_left, chatbot_left1, chatbot_right, chatbot_right1, vote_textbox, right_vote_text, rank] ).then( submit_response_rank_igm, inputs=[state0, state1, state2, state3, dummy_left_model, dummy_left1_model, dummy_right_model, dummy_right1_model, textbox, rank, right_vote_text, user_name, user_institution], outputs=[A1_btn, A2_btn, A3_btn, A4_btn, B1_btn, B2_btn, B3_btn, B4_btn, C1_btn, C2_btn, C3_btn, C4_btn, D1_btn, D2_btn, D3_btn, D4_btn, \ vote_textbox, vote_submit_btn, vote_mode_btn, right_vote_text, \ model_selector_left, model_selector_left1, model_selector_right, model_selector_right1], api_name="submit_btn_annony" ) vote_submit_btn.click( disable_vote, inputs=None, outputs=[vote_submit_btn, vote_mode_btn, \ A1_btn, A2_btn, A3_btn, A4_btn, B1_btn, B2_btn, B3_btn, B4_btn, C1_btn, C2_btn, C3_btn, C4_btn, D1_btn, D2_btn, D3_btn, D4_btn] ).then( text_response_rank_igm, inputs=[generate_ig0, generate_ig1, generate_ig2, generate_ig3, Top1_text, Top2_text, Top3_text, Top4_text, vote_textbox], outputs=[chatbot_left, chatbot_left1, chatbot_right, chatbot_right1, vote_textbox, right_vote_text, rank] ).then( submit_response_rank_igm, inputs=[state0, state1, state2, state3, dummy_left_model, dummy_left1_model, dummy_right_model, dummy_right1_model, textbox, rank, right_vote_text, user_name, user_institution], outputs=[A1_btn, A2_btn, A3_btn, A4_btn, B1_btn, B2_btn, B3_btn, B4_btn, C1_btn, C2_btn, C3_btn, C4_btn, D1_btn, D2_btn, D3_btn, D4_btn, \ vote_textbox, vote_submit_btn, vote_mode_btn, right_vote_text, \ model_selector_left, model_selector_left1, model_selector_right, model_selector_right1], api_name="submit_btn_annony" ) # Revote_btn.click( # revote_windows, # inputs=[generate_ig0, generate_ig1, generate_ig2, generate_ig3, rank, vote_level], # outputs=[chatbot_left, chatbot_left1, chatbot_right, chatbot_right1, rank, vote_level] # ).then( # reset_submit, # inputs = [rank], # outputs = [Submit_btn] # ) # Submit_btn.click( # submit_response_igm, # inputs=[state0, state1, state2, state3, dummy_left_model, dummy_left1_model, dummy_right_model, dummy_right1_model, rank], # outputs=[textbox, Top1_btn, Top2_btn, Top3_btn, Top4_btn, Revote_btn, Submit_btn, \ # model_selector_left, model_selector_left1, model_selector_right, model_selector_right1] # ) # chatbot_left.select(add_foreground, inputs=[generate_ig0, vote_level, Top1_text, Top2_text, Top3_text, Top4_text], outputs=[chatbot_left]).then( # reset_rank, # inputs = [window1_text, rank, vote_level], # outputs = [rank] # ).then( # reset_submit, # inputs = [rank], # outputs = [Submit_btn] # ) # chatbot_left1.select(add_foreground, inputs=[generate_ig1, vote_level, Top1_text, Top2_text, Top3_text, Top4_text], outputs=[chatbot_left1]).then( # reset_rank, # inputs = [window2_text, rank, vote_level], # outputs = [rank] # ).then( # reset_submit, # inputs = [rank], # outputs = [Submit_btn] # ) # chatbot_right.select(add_foreground, inputs=[generate_ig2, vote_level, Top1_text, Top2_text, Top3_text, Top4_text], outputs=[chatbot_right]).then( # reset_rank, # inputs = [window3_text, rank, vote_level], # outputs = [rank] # ).then( # reset_submit, # inputs = [rank], # outputs = [Submit_btn] # ) # chatbot_right1.select(add_foreground, inputs=[generate_ig3, vote_level, Top1_text, Top2_text, Top3_text, Top4_text], outputs=[chatbot_right1]).then( # reset_rank, # inputs = [window4_text, rank, vote_level], # outputs = [rank] # ).then( # reset_submit, # inputs = [rank], # outputs = [Submit_btn] # ) leftvote_btn.click( submit_response_igm, inputs=[state0, state1, state2, state3, dummy_left_model, dummy_left1_model, dummy_right_model, dummy_right1_model, textbox, rankA, user_name, user_institution], outputs=[textbox, leftvote_btn, left1vote_btn, rightvote_btn, right1vote_btn, tie_btn, \ model_selector_left, model_selector_left1, model_selector_right, model_selector_right1, \ vote_mode_btn] ) left1vote_btn.click( submit_response_igm, inputs=[state0, state1, state2, state3, dummy_left_model, dummy_left1_model, dummy_right_model, dummy_right1_model, textbox, rankB, user_name, user_institution], outputs=[textbox, leftvote_btn, left1vote_btn, rightvote_btn, right1vote_btn, tie_btn, \ model_selector_left, model_selector_left1, model_selector_right, model_selector_right1, \ vote_mode_btn] ) rightvote_btn.click( submit_response_igm, inputs=[state0, state1, state2, state3, dummy_left_model, dummy_left1_model, dummy_right_model, dummy_right1_model, textbox, rankC, user_name, user_institution], outputs=[textbox, leftvote_btn, left1vote_btn, rightvote_btn, right1vote_btn, tie_btn, \ model_selector_left, model_selector_left1, model_selector_right, model_selector_right1, \ vote_mode_btn] ) right1vote_btn.click( submit_response_igm, inputs=[state0, state1, state2, state3, dummy_left_model, dummy_left1_model, dummy_right_model, dummy_right1_model, textbox, rankD, user_name, user_institution], outputs=[textbox, leftvote_btn, left1vote_btn, rightvote_btn, right1vote_btn, tie_btn, \ model_selector_left, model_selector_left1, model_selector_right, model_selector_right1, \ vote_mode_btn] ) tie_btn.click( submit_response_igm, inputs=[state0, state1, state2, state3, dummy_left_model, dummy_left1_model, dummy_right_model, dummy_right1_model, textbox, rankTie, user_name, user_institution], outputs=[textbox, leftvote_btn, left1vote_btn, rightvote_btn, right1vote_btn, tie_btn, \ model_selector_left, model_selector_left1, model_selector_right, model_selector_right1, \ vote_mode_btn] ) A1_btn.click( reset_btn_rank, inputs=[window1_text, rank, A1_btn, vote_level], outputs=[rank, vote_level] ).then( add_foreground, inputs=[generate_ig0, vote_level, Top1_text, Top2_text, Top3_text, Top4_text], outputs=[chatbot_left] ).then( reset_submit, inputs = [rank], outputs = [vote_submit_btn] ).then( reset_vote_text, inputs = [rank], outputs = [vote_textbox] ) A2_btn.click( reset_btn_rank, inputs=[window1_text, rank, A2_btn, vote_level], outputs=[rank, vote_level] ).then( add_foreground, inputs=[generate_ig0, vote_level, Top1_text, Top2_text, Top3_text, Top4_text], outputs=[chatbot_left] ).then( reset_submit, inputs = [rank], outputs = [vote_submit_btn] ).then( reset_vote_text, inputs = [rank], outputs = [vote_textbox] ) A3_btn.click( reset_btn_rank, inputs=[window1_text, rank, A3_btn, vote_level], outputs=[rank, vote_level] ).then( add_foreground, inputs=[generate_ig0, vote_level, Top1_text, Top2_text, Top3_text, Top4_text], outputs=[chatbot_left] ).then( reset_submit, inputs = [rank], outputs = [vote_submit_btn] ).then( reset_vote_text, inputs = [rank], outputs = [vote_textbox] ) A4_btn.click( reset_btn_rank, inputs=[window1_text, rank, A4_btn, vote_level], outputs=[rank, vote_level] ).then( add_foreground, inputs=[generate_ig0, vote_level, Top1_text, Top2_text, Top3_text, Top4_text], outputs=[chatbot_left] ).then( reset_submit, inputs = [rank], outputs = [vote_submit_btn] ).then( reset_vote_text, inputs = [rank], outputs = [vote_textbox] ) B1_btn.click( reset_btn_rank, inputs=[window2_text, rank, B1_btn, vote_level], outputs=[rank, vote_level] ).then( add_foreground, inputs=[generate_ig1, vote_level, Top1_text, Top2_text, Top3_text, Top4_text], outputs=[chatbot_left1] ).then( reset_submit, inputs = [rank], outputs = [vote_submit_btn] ).then( reset_vote_text, inputs = [rank], outputs = [vote_textbox] ) B2_btn.click( reset_btn_rank, inputs=[window2_text, rank, B2_btn, vote_level], outputs=[rank, vote_level] ).then( add_foreground, inputs=[generate_ig1, vote_level, Top1_text, Top2_text, Top3_text, Top4_text], outputs=[chatbot_left1] ).then( reset_submit, inputs = [rank], outputs = [vote_submit_btn] ).then( reset_vote_text, inputs = [rank], outputs = [vote_textbox] ) B3_btn.click( reset_btn_rank, inputs=[window2_text, rank, B3_btn, vote_level], outputs=[rank, vote_level] ).then( add_foreground, inputs=[generate_ig1, vote_level, Top1_text, Top2_text, Top3_text, Top4_text], outputs=[chatbot_left1] ).then( reset_submit, inputs = [rank], outputs = [vote_submit_btn] ).then( reset_vote_text, inputs = [rank], outputs = [vote_textbox] ) B4_btn.click( reset_btn_rank, inputs=[window2_text, rank, B4_btn, vote_level], outputs=[rank, vote_level] ).then( add_foreground, inputs=[generate_ig1, vote_level, Top1_text, Top2_text, Top3_text, Top4_text], outputs=[chatbot_left1] ).then( reset_submit, inputs = [rank], outputs = [vote_submit_btn] ).then( reset_vote_text, inputs = [rank], outputs = [vote_textbox] ) C1_btn.click( reset_btn_rank, inputs=[window3_text, rank, C1_btn, vote_level], outputs=[rank, vote_level] ).then( add_foreground, inputs=[generate_ig2, vote_level, Top1_text, Top2_text, Top3_text, Top4_text], outputs=[chatbot_right] ).then( reset_submit, inputs = [rank], outputs = [vote_submit_btn] ).then( reset_vote_text, inputs = [rank], outputs = [vote_textbox] ) C2_btn.click( reset_btn_rank, inputs=[window3_text, rank, C2_btn, vote_level], outputs=[rank, vote_level] ).then( add_foreground, inputs=[generate_ig2, vote_level, Top1_text, Top2_text, Top3_text, Top4_text], outputs=[chatbot_right] ).then( reset_submit, inputs = [rank], outputs = [vote_submit_btn] ).then( reset_vote_text, inputs = [rank], outputs = [vote_textbox] ) C3_btn.click( reset_btn_rank, inputs=[window3_text, rank, C3_btn, vote_level], outputs=[rank, vote_level] ).then( add_foreground, inputs=[generate_ig2, vote_level, Top1_text, Top2_text, Top3_text, Top4_text], outputs=[chatbot_right] ).then( reset_submit, inputs = [rank], outputs = [vote_submit_btn] ).then( reset_vote_text, inputs = [rank], outputs = [vote_textbox] ) C4_btn.click( reset_btn_rank, inputs=[window3_text, rank, C4_btn, vote_level], outputs=[rank, vote_level] ).then( add_foreground, inputs=[generate_ig2, vote_level, Top1_text, Top2_text, Top3_text, Top4_text], outputs=[chatbot_right] ).then( reset_submit, inputs = [rank], outputs = [vote_submit_btn] ).then( reset_vote_text, inputs = [rank], outputs = [vote_textbox] ) D1_btn.click( reset_btn_rank, inputs=[window4_text, rank, D1_btn, vote_level], outputs=[rank, vote_level] ).then( add_foreground, inputs=[generate_ig3, vote_level, Top1_text, Top2_text, Top3_text, Top4_text], outputs=[chatbot_right1] ).then( reset_submit, inputs = [rank], outputs = [vote_submit_btn] ).then( reset_vote_text, inputs = [rank], outputs = [vote_textbox] ) D2_btn.click( reset_btn_rank, inputs=[window4_text, rank, D2_btn, vote_level], outputs=[rank, vote_level] ).then( add_foreground, inputs=[generate_ig3, vote_level, Top1_text, Top2_text, Top3_text, Top4_text], outputs=[chatbot_right1] ).then( reset_submit, inputs = [rank], outputs = [vote_submit_btn] ).then( reset_vote_text, inputs = [rank], outputs = [vote_textbox] ) D3_btn.click( reset_btn_rank, inputs=[window4_text, rank, D3_btn, vote_level], outputs=[rank, vote_level] ).then( add_foreground, inputs=[generate_ig3, vote_level, Top1_text, Top2_text, Top3_text, Top4_text], outputs=[chatbot_right1] ).then( reset_submit, inputs = [rank], outputs = [vote_submit_btn] ).then( reset_vote_text, inputs = [rank], outputs = [vote_textbox] ) D4_btn.click( reset_btn_rank, inputs=[window4_text, rank, D4_btn, vote_level], outputs=[rank, vote_level] ).then( add_foreground, inputs=[generate_ig3, vote_level, Top1_text, Top2_text, Top3_text, Top4_text], outputs=[chatbot_right1] ).then( reset_submit, inputs = [rank], outputs = [vote_submit_btn] ).then( reset_vote_text, inputs = [rank], outputs = [vote_textbox] )