SathvikGanta commited on
Commit
034a48f
·
verified ·
1 Parent(s): ecc5903

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +33 -18
app.py CHANGED
@@ -1,24 +1,39 @@
1
  import gradio as gr
2
- from components.cards import create_food_card
3
- from components.data import FOOD_DATA
4
 
5
- # Function to render a card based on selected item
6
- def display_card(food_name):
7
- return create_food_card(food_name)
 
 
 
 
8
 
9
- # Dropdown with food items
10
- food_items = list(FOOD_DATA.keys())
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
11
 
12
- # Gradio app interface
13
- with gr.Blocks(css="styles.css") as app:
14
- gr.Markdown("# 🍽️ Indian & Chinese Food Nutritional Information")
15
- gr.Markdown("### Click on a food item to explore its nutritional details.")
16
- with gr.Row():
17
- food_dropdown = gr.Dropdown(label="Select a Dish", choices=food_items)
18
- display_area = gr.HTML()
19
 
20
- # Event to update the display area with card
21
- food_dropdown.change(display_card, inputs=food_dropdown, outputs=display_area)
22
 
23
- # Run the app
24
- app.launch()
 
 
1
  import gradio as gr
 
 
2
 
3
+ # Define menu items
4
+ menu_items = [
5
+ {"name": "Chicken Butter Masala"},
6
+ {"name": "Chicken Biryani"},
7
+ {"name": "Dosa"},
8
+ {"name": "Aloo Curry"},
9
+ ]
10
 
11
+ # Create the Gradio interface
12
+ def render_menu():
13
+ with gr.Blocks(css="""
14
+ .menu-item {
15
+ border: 2px solid black;
16
+ border-radius: 5px;
17
+ padding: 15px;
18
+ margin: 10px 0;
19
+ font-size: 18px;
20
+ font-weight: bold;
21
+ text-align: center;
22
+ background-color: #fff;
23
+ }
24
+ .menu-container {
25
+ margin-top: 20px;
26
+ }
27
+ """) as demo:
28
+ gr.Markdown("# Menu")
29
 
30
+ with gr.Column(elem_id="menu-container"):
31
+ for item in menu_items:
32
+ with gr.Row(className="menu-item"):
33
+ gr.Markdown(item["name"])
 
 
 
34
 
35
+ return demo
 
36
 
37
+ # Render the app
38
+ demo = render_menu()
39
+ demo.launch()