DSatishchandra commited on
Commit
ddecc3d
·
verified ·
1 Parent(s): 920d44a

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +12 -10
app.py CHANGED
@@ -6,26 +6,28 @@ def load_menu(file_path="menu.xlsx"):
6
  menu_data = pd.read_excel(file_path)
7
  return menu_data
8
 
9
- # Filter the menu based on user preference
10
  def filter_menu(preference):
11
  menu_data = load_menu()
12
-
13
  if preference != "All":
14
  filtered_data = menu_data[menu_data["Category"] == preference]
15
  else:
16
  filtered_data = menu_data
17
 
18
- # Generate HTML for filtered menu
19
  html_content = ""
20
  for _, item in filtered_data.iterrows():
21
  html_content += f"""
22
- <div style="border: 1px solid #ddd; margin: 10px; padding: 10px; border-radius: 8px; display: flex; align-items: center;">
23
- <img src="{item['Image URL']}" alt="{item['Dish Name']}" style="width: 100px; height: 100px; object-fit: cover; margin-right: 10px;">
24
- <div>
25
- <h4>{item['Dish Name']}</h4>
26
- <p>{item['Description']}</p>
27
- <p><strong>Price:</strong> ${item['Price']}</p>
28
- <button style="background-color: #28a745; color: white; border: none; padding: 5px 10px; border-radius: 5px; cursor: pointer;">Add</button>
 
 
29
  </div>
30
  </div>
31
  """
 
6
  menu_data = pd.read_excel(file_path)
7
  return menu_data
8
 
9
+ # Filter and generate the menu layout
10
  def filter_menu(preference):
11
  menu_data = load_menu()
12
+
13
  if preference != "All":
14
  filtered_data = menu_data[menu_data["Category"] == preference]
15
  else:
16
  filtered_data = menu_data
17
 
18
+ # Generate HTML for the menu
19
  html_content = ""
20
  for _, item in filtered_data.iterrows():
21
  html_content += f"""
22
+ <div style="display: flex; align-items: center; border: 1px solid #ddd; border-radius: 8px; padding: 15px; margin-bottom: 10px; box-shadow: 0px 4px 8px rgba(0, 0, 0, 0.1);">
23
+ <div style="flex: 1; margin-right: 15px;">
24
+ <h3 style="margin: 0; font-size: 18px;">{item['Dish Name']}</h3>
25
+ <p style="margin: 5px 0; font-size: 16px; color: #888;">₹{item['Price']}</p>
26
+ <p style="margin: 5px 0; font-size: 14px; color: #555;">{item['Description']}</p>
27
+ </div>
28
+ <div style="flex-shrink: 0; text-align: center;">
29
+ <img src="{item['Image URL']}" alt="{item['Dish Name']}" style="width: 100px; height: 100px; border-radius: 8px; object-fit: cover; margin-bottom: 10px;">
30
+ <button style="background-color: #28a745; color: white; border: none; padding: 8px 15px; font-size: 14px; border-radius: 5px; cursor: pointer;">Add</button>
31
  </div>
32
  </div>
33
  """