DSatishchandra commited on
Commit
56f3824
·
verified ·
1 Parent(s): 574383b

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +15 -22
app.py CHANGED
@@ -1,27 +1,20 @@
1
  import gradio as gr
2
 
3
- # Function to load the menu data from Excel
4
- def load_menu():
5
- menu_file = "menu.xlsx" # Ensure this file exists in the same directory
6
- try:
7
- return pd.read_excel(menu_file)
8
- except Exception as e:
9
- raise ValueError(f"Error loading menu file: {e}")
10
-
11
- # Function to filter menu items based on preference
12
- def filter_menu(preference):
13
- # Load menu data
14
- menu_data = load_menu()
15
-
16
- # Define filter conditions
17
- if preference == "Halal/Non-Veg":
18
- filtered_data = menu_data[menu_data["Ingredients"].str.contains("Chicken|Mutton|Fish|Prawns|Goat", case=False, na=False)]
19
- elif preference == "Vegetarian":
20
- filtered_data = menu_data[~menu_data["Ingredients"].str.contains("Chicken|Mutton|Fish|Prawns|Goat", case=False, na=False)]
21
- elif preference == "Guilt-Free":
22
- filtered_data = menu_data[menu_data["Description"].str.contains(r"Fat: ([0-9]|10)g", case=False, na=False)]
23
- else: # Default to "All"
24
- filtered_data = menu_data
25
 
26
  # Step 2: Generate HTML for food items
27
  def generate_food_menu():
 
1
  import gradio as gr
2
 
3
+ # Step 1: Define food items
4
+ food_items = [
5
+ {
6
+ "name": "Samosa",
7
+ "price": "$0.6",
8
+ "description": "Crispy fried pastry filled with spiced potatoes and peas. Serves 1. [Energy: 200 kcal, Protein: 5g, Carbohydrates: 25g, Fiber: 3g, Fat: 10g, Sugar: 1g]",
9
+ "image": "https://huggingface.co/spaces/DSatishchandra/DynamicFoodMenu/raw/main/images/Potato-Samosa.jpg"
10
+ },
11
+ {
12
+ "name": "Onion Pakoda",
13
+ "price": "$0.75",
14
+ "description": "Deep-fried onion fritters seasoned with herbs and spices. Serves 2. [Energy: 250 kcal, Protein: 6g, Carbohydrates: 30g, Fiber: 4g, Fat: 12g, Sugar: 2g]",
15
+ "image": "https://huggingface.co/spaces/DSatishchandra/DynamicFoodMenu/raw/main/images/onion-pakoda.jpg"
16
+ }
17
+ ]
 
 
 
 
 
 
 
18
 
19
  # Step 2: Generate HTML for food items
20
  def generate_food_menu():