Kawthar12h
commited on
Commit
•
c95db02
1
Parent(s):
a831051
Create app.py
Browse files
app.py
ADDED
@@ -0,0 +1,24 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
import gradio as gr
|
2 |
+
|
3 |
+
# Define a function that takes the name of a food and returns its ingredients
|
4 |
+
def get_ingredients(food_name):
|
5 |
+
ingredients_dict = {
|
6 |
+
"pizza": ["Dough", "Tomato Sauce", "Cheese", "Pepperoni"],
|
7 |
+
"pasta": ["Pasta", "Olive Oil", "Garlic", "Parmesan Cheese"],
|
8 |
+
"burger": ["Bun", "Beef Patty", "Lettuce", "Tomato", "Cheese"],
|
9 |
+
"salad": ["Lettuce", "Tomatoes", "Cucumbers", "Dressing"],
|
10 |
+
"tacos": ["Tortilla", "Beef", "Lettuce", "Cheese", "Salsa"]
|
11 |
+
}
|
12 |
+
return ingredients_dict.get(food_name.lower(), "Ingredients not found for this food item.")
|
13 |
+
|
14 |
+
# Create a Gradio interface
|
15 |
+
interface = gr.Interface(
|
16 |
+
fn=get_ingredients, # The function to call
|
17 |
+
inputs="text", # Input type is text
|
18 |
+
outputs="text", # Output type is text
|
19 |
+
title="Food Ingredients Finder",
|
20 |
+
description="Enter the name of a food to get its ingredients."
|
21 |
+
)
|
22 |
+
|
23 |
+
# Launch the Gradio app
|
24 |
+
interface.launch()
|