import gradio as gr # Define a function that takes the name of a food and returns its ingredients def get_ingredients(food_name): ingredients_dict = { "pizza": ["Dough", "Tomato Sauce", "Cheese", "Pepperoni"], "pasta": ["Pasta", "Olive Oil", "Garlic", "Parmesan Cheese"], "burger": ["Bun", "Beef Patty", "Lettuce", "Tomato", "Cheese"], "salad": ["Lettuce", "Tomatoes", "Cucumbers", "Dressing"], "tacos": ["Tortilla", "Beef", "Lettuce", "Cheese", "Salsa"] } return ingredients_dict.get(food_name.lower(), "Ingredients not found for this food item.") # Create a Gradio interface interface = gr.Interface( fn=get_ingredients, # The function to call inputs="text", # Input type is text outputs="text", # Output type is text title="Food Ingredients Finder", description="Enter the name of a food to get its ingredients." ) # Launch the Gradio app interface.launch()