Update app.py
Browse files39 unmodified lines40414243444514 unmodified lines606162636465664 unmodified lines717273747576777879808139 unmodified linesreturn 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):return respond(model_name, message, history, system_message), gr.update(visible=False) # Hide dropdown after click# Define the Gradio interface with buttons and model selectiondemo = gr.Interface(4 unmodified linesgr.Button("Chatgpt"),gr.Button("Llama"),gr.Button("Claude"),gr.State() # To track the state of dropdown visibility],outputs=["text", # For the model's responsegr.Textbox(visible=False) # Dropdown (this textbox will be hidden after the button is clicked)],css=css, # Pass the custom CSS here)39 unmodified lines4041424344454614 unmodified lines61626364656667684 unmodified lines737475767778798081828339 unmodified linesreturn 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 Falsereturn respond(model_name, message, history, system_message), gr.update(visible=False)# Define the Gradio interface with buttons and model selectiondemo = gr.Interface(4 unmodified linesgr.Button("Chatgpt"),gr.Button("Llama"),gr.Button("Claude"),gr.State(value=False), # Add state to track visibility of the dropdown],outputs=["text", # For the model's responsegr.State(value=False), # This should be the state output, which tracks visibility],css=css, # Pass the custom CSS here)
app.py+5-3