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, 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_btn_rank, reset_vote_text, text_response_rank_igm, ) from functools import partial def build_side_by_side_ui_anony(models): notice_markdown = """ # βš”οΈ Text2Image-Arena βš”οΈ ## πŸ“œ Rules - Input prompt to two anonymous models in same area (e.g., SD, SDXL, OpenJourney in Text-guided Image Generation Model) and vote for the better one! - When the results are ready, click the button below to vote. - Vote won't be counted if model identity is revealed during conversation. - Click "New Round" to start a new round. ## πŸ† Arena Elo Find out who is the πŸ₯‡conditional image generation models! More models are going to be supported. ## πŸ‘‡ Generating now! """ 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_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(): leftvote_btn = gr.Button( value="A is Best", visible=False, interactive=False ) left1vote_btn = gr.Button( value="B is Best", visible=False, interactive=False ) rightvote_btn = gr.Button( value="C is Best", visible=False, interactive=False ) right1vote_btn = gr.Button( value="D is Best", visible=False, interactive=False ) tie_btn = gr.Button(value="🀝 Tie", visible=False, interactive=False) bothbad_btn = gr.Button( value="πŸ‘Ž Both are bad", visible=False, interactive=False ) with gr.Row(): Top1_btn = gr.Button( value="Top1", visible=False, interactive=False ) Top2_btn = gr.Button( value="Top2", visible=False, interactive=False ) Top3_btn = gr.Button( value="Top3", visible=False, interactive=False ) Top4_btn = gr.Button( value="Top4", visible=False, interactive=False ) Revote_btn = gr.Button( value="Re-vote", visible=False, interactive=False ) Submit_btn = gr.Button(value="🀝 Submit", visible=False, interactive=False) 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", container=True, elem_id="input_box", visible=False, ) vote_submit_btn = gr.Button(value="Submit", visible=False, interactive=False, variant="primary", scale=0) vote_mode_btn = gr.Button(value="πŸ”„ Mode", visible=False, interactive=False, variant="primary", scale=0) 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) draw_btn = gr.Button(value="🎲 Random sample", variant="primary", scale=0) 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") #gr.Markdown(acknowledgment_md, elem_id="ack_markdown") dummy_img_output = gr.Image(width=512, visible=False) gr.Examples( examples=[["a cute dog is playing a ball", os.path.join("./examples", "dog.jpg")], ["Buildings on fire, old film still", os.path.join("./examples", "fire.jpg")], ["Lonely evil bananas on a table, hard light chiaroscuro, realistic",os.path.join("./examples", "banana.jpg")], ["A futuristic hopeful busy city, purple and green color scheme", os.path.join("./examples", "city.jpg")]], inputs = [textbox, dummy_img_output]) btn_list = [leftvote_btn, left1vote_btn, rightvote_btn, right1vote_btn, tie_btn, bothbad_btn] vote_list = [Top1_btn, Top2_btn, Top3_btn, Top4_btn, Revote_btn, Submit_btn] order_btn_list = [send_btn, draw_btn, clear_btn, regenerate_btn] vote_order_list = [leftvote_btn, left1vote_btn, rightvote_btn, right1vote_btn, tie_btn, bothbad_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_rank_list = [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] 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="Best", visible=False, interactive=False) right_vote_text = gr.Textbox(value="wrong", visible=False, interactive=False) textbox.submit( 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( disable_order_buttons, inputs=None, outputs=order_btn_list ).then( enable_vote_mode_buttons, inputs=[vote_mode], outputs=vote_order_list ) send_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, 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( disable_order_buttons, inputs=None, outputs=order_btn_list ).then( enable_vote_mode_buttons, inputs=[vote_mode], outputs=vote_order_list ) draw_btn.click( gen_func_random, 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, \ textbox, model_selector_left, model_selector_left1, model_selector_right, model_selector_right1], api_name="draw_btn_annony" ).then( disable_order_buttons, inputs=None, outputs=order_btn_list ).then( enable_vote_mode_buttons, inputs=[vote_mode], outputs=vote_order_list ) # .then( # enable_vote_buttons, # inputs=None, # outputs=vote_list # ) 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( disable_vote_buttons, inputs=None, outputs=vote_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_mode, inputs=[vote_mode], outputs=[leftvote_btn, left1vote_btn, rightvote_btn, right1vote_btn, tie_btn, bothbad_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( 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, rank, right_vote_text], 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( 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, rank, right_vote_text], 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, rankA], outputs=[textbox, leftvote_btn, left1vote_btn, rightvote_btn, right1vote_btn, tie_btn, bothbad_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, rankB], outputs=[textbox, leftvote_btn, left1vote_btn, rightvote_btn, right1vote_btn, tie_btn, bothbad_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, rankC], outputs=[textbox, leftvote_btn, left1vote_btn, rightvote_btn, right1vote_btn, tie_btn, bothbad_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, rankD], outputs=[textbox, leftvote_btn, left1vote_btn, rightvote_btn, right1vote_btn, tie_btn, bothbad_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, rankTie], outputs=[textbox, leftvote_btn, left1vote_btn, rightvote_btn, right1vote_btn, tie_btn, bothbad_btn, \ model_selector_left, model_selector_left1, model_selector_right, model_selector_right1, \ vote_mode_btn] ) bothbad_btn.click( submit_response_igm, inputs=[state0, state1, state2, state3, dummy_left_model, dummy_left1_model, dummy_right_model, dummy_right1_model, rankBad], outputs=[textbox, leftvote_btn, left1vote_btn, rightvote_btn, right1vote_btn, tie_btn, bothbad_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] )