nagasurendra commited on
Commit
24f4ccd
·
verified ·
1 Parent(s): 803113c

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +9 -9
app.py CHANGED
@@ -1,7 +1,7 @@
1
  import gradio as gr
2
  import pandas as pd
3
 
4
- # Function to load menu data from Excel
5
  def load_menu():
6
  try:
7
  return pd.read_excel("menu.xlsx") # Ensure menu.xlsx exists in the same directory
@@ -24,11 +24,11 @@ def filter_menu(preference):
24
  html_content = ""
25
  for _, item in filtered_data.iterrows():
26
  html_content += f"""
27
- <div class="menu-item">
28
- <img src="{item['Image URL']}" alt="{item['Dish Name']}" class="dish-image">
29
- <h3>{item['Dish Name']}</h3>
30
- <p>{item['Description']}</p>
31
- <p><strong>${item['Price ($)']}</strong></p>
32
  <button onclick="showModal('{item['Dish Name']}')" class="add-button">Add</button>
33
  </div>
34
  """
@@ -52,9 +52,9 @@ def get_dish_details(dish_name):
52
  # Main Gradio app
53
  def app():
54
  with gr.Blocks(css="style.css") as demo:
55
- gr.Markdown("## Dynamic Menu with Modal Window")
56
 
57
- # Home page menu
58
  preference_selector = gr.Radio(
59
  choices=["All", "Vegetarian", "Halal/Non-Veg", "Guilt-Free"],
60
  value="All",
@@ -62,7 +62,7 @@ def app():
62
  )
63
  menu_output = gr.HTML(value=filter_menu("All"))
64
 
65
- # Modal (hidden by default)
66
  modal = gr.Column(visible=False, elem_classes=["popup"])
67
  modal_image = gr.Image(label="Dish Image")
68
  modal_name = gr.Markdown()
 
1
  import gradio as gr
2
  import pandas as pd
3
 
4
+ # Load menu data from Excel
5
  def load_menu():
6
  try:
7
  return pd.read_excel("menu.xlsx") # Ensure menu.xlsx exists in the same directory
 
24
  html_content = ""
25
  for _, item in filtered_data.iterrows():
26
  html_content += f"""
27
+ <div class="menu-card">
28
+ <img src="{item['Image URL']}" alt="{item['Dish Name']}" class="menu-image">
29
+ <h3 class="menu-title">{item['Dish Name']}</h3>
30
+ <p class="menu-description">{item['Description']}</p>
31
+ <p class="menu-price"><strong>${item['Price ($)']}</strong></p>
32
  <button onclick="showModal('{item['Dish Name']}')" class="add-button">Add</button>
33
  </div>
34
  """
 
52
  # Main Gradio app
53
  def app():
54
  with gr.Blocks(css="style.css") as demo:
55
+ gr.Markdown("## Dynamic Menu with Modal Suggestion Page")
56
 
57
+ # Homepage
58
  preference_selector = gr.Radio(
59
  choices=["All", "Vegetarian", "Halal/Non-Veg", "Guilt-Free"],
60
  value="All",
 
62
  )
63
  menu_output = gr.HTML(value=filter_menu("All"))
64
 
65
+ # Modal Window
66
  modal = gr.Column(visible=False, elem_classes=["popup"])
67
  modal_image = gr.Image(label="Dish Image")
68
  modal_name = gr.Markdown()