Update app.py
Browse files39 unmodified lines4041424344454614 unmodified lines6162636463656667684 unmodified lines7374757476777879788081828339 unmodified lines
return response
# CSS for styling the interfacecss = """body {14 unmodified lines
# Define the button click handler to hide the dropdowndef on_button_click(model_name, message, history, system_message, dropdown_state): # Close the dropdown by setting the state to False return respond(model_name, message, history, system_message), gr.update(visible=False) # Hide dropdown after click return respond(model_name, message, history, system_message), gr.update(visible=False)
# Define the Gradio interface with buttons and model selectiondemo = gr.Interface(4 unmodified lines gr.Button("Chatgpt"), gr.Button("Llama"), gr.Button("Claude"), gr.State() # To track the state of dropdown visibility gr.State(value=False), # Add state to track visibility of the dropdown ], outputs=[ "text", # For the model's response gr.Textbox(visible=False) # Dropdown (this textbox will be hidden after the button is clicked) gr.State(value=False), # This should be the state output, which tracks visibility ], css=css, # Pass the custom CSS here)app.py+5-3