Spaces:
Sleeping
Sleeping
File size: 945 Bytes
c95db02 |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 |
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()
|