Rammohan0504 commited on
Commit
d72e91a
·
verified ·
1 Parent(s): 8f297a1

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +6 -5
app.py CHANGED
@@ -54,8 +54,8 @@ def display_dishes(category):
54
  def get_dish_details(dish_name):
55
  for dish in menu_data:
56
  if dish["name"] == dish_name:
57
- return (dish["image"], dish["name"], dish["description"], "🌶 Medium", "🍽 Regular")
58
- return ("https://via.placeholder.com/300x200", "Unknown Dish", "No description available.", "N/A", "N/A")
59
 
60
  # Function to simulate placing an order
61
  def place_order(dish_name, spice_level, portion_size):
@@ -76,7 +76,7 @@ with gr.Blocks() as demo:
76
  gr.Markdown("### Available Dishes")
77
  dish_display = gr.HTML(value=display_dishes("ALL"))
78
 
79
- # Detailed Dish View
80
  gr.Markdown("### Dish Details")
81
  with gr.Row():
82
  dish_image = gr.Image(label="Dish Image", height=200, width=200)
@@ -117,8 +117,9 @@ with gr.Blocks() as demo:
117
  gr.HTML("""
118
  <script>
119
  function selectDish(dishName) {
120
- document.querySelector('input[aria-label="selected_dish_name"]').value = dishName;
121
- document.querySelector('input[aria-label="selected_dish_name"]').dispatchEvent(new Event('input'));
 
122
  }
123
  </script>
124
  """)
 
54
  def get_dish_details(dish_name):
55
  for dish in menu_data:
56
  if dish["name"] == dish_name:
57
+ return dish["image"], dish["name"], dish["description"], "🌶 Medium", "🍽 Medium"
58
+ return "https://via.placeholder.com/300x200", "Unknown Dish", "No description available.", "N/A", "N/A"
59
 
60
  # Function to simulate placing an order
61
  def place_order(dish_name, spice_level, portion_size):
 
76
  gr.Markdown("### Available Dishes")
77
  dish_display = gr.HTML(value=display_dishes("ALL"))
78
 
79
+ # Dish Details Section
80
  gr.Markdown("### Dish Details")
81
  with gr.Row():
82
  dish_image = gr.Image(label="Dish Image", height=200, width=200)
 
117
  gr.HTML("""
118
  <script>
119
  function selectDish(dishName) {
120
+ let input = document.querySelector('input[aria-label="selected_dish_name"]');
121
+ input.value = dishName;
122
+ input.dispatchEvent(new Event('input', { bubbles: true }));
123
  }
124
  </script>
125
  """)