# Show dish details when an item is selected menu_dropdown.change( show_dish_details, inputs=[menu_dropdown], outputs=[ menu_dropdown, detailed_view, dish_image, dish_name, dish_description, dish_price, ], ) # Handle adding items to the cart add_button.click( handle_add_to_cart, inputs=[ dish_name, spice_level, extras, quantity, special_instructions, cart_state, ], outputs=[cart_state, cart_view], ) # Back button to return to menu back_button.click( lambda: (gr.update(visible=True), gr.update(visible=False)), outputs=[menu_dropdown, detailed_view], ) # Layout for Gradio app with gr.Row(): gr.Markdown("## Menu") menu_dropdown cart_view with detailed_view: dish_image dish_name dish_description dish_price spice_level extras quantity special_instructions add_button back_button return demo if __name__ == "__main__": demo = app() demo.launch()