Spaces:
Runtime error
Runtime error
File size: 1,420 Bytes
6011c2a 1172cec 495cb34 1172cec 495cb34 bee2172 1172cec 495cb34 1172cec 97cc930 495cb34 1172cec 495cb34 1172cec 185e476 97cc930 | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 | import gradio as gr
# Menu Data
menu_data = {
"Tikka Murgh (Chicken)": {
"price": "$16",
"nutrition": "Calories: 220, Protein: 20g, Fat: 10g, Carbs: 5g",
"portion": "250g",
"image": "static/Tikka_Murgh_Chicken.png",
},
"Jhinga (Shrimp)": {
"price": "$18",
"nutrition": "Calories: 180, Protein: 25g, Fat: 8g, Carbs: 3g",
"portion": "200g",
"image": "static/Jhinga_Shrimp.jpg",
},
"Murgh Malai Kabob": {
"price": "$17",
"nutrition": "Calories: 240, Protein: 22g, Fat: 12g, Carbs: 7g",
"portion": "300g",
"image": "static/Murgh_Malai_Kabob.jpg",
},
}
# Display Card Function
def display_card(item_name):
data = menu_data[item_name]
return f"""
<div style="border:1px solid #ccc; padding:10px; border-radius:10px; width:300px; background-color:white;">
<img src="{data['image']}" style="width:100%; border-radius:10px;" alt="{item_name}">
<h3>{item_name} - {data['price']}</h3>
<p>Nutrition: {data['nutrition']}</p>
<p>Portion Size: {data['portion']}</p>
</div>
"""
# Gradio Interface
with gr.Blocks() as app:
gr.Markdown("### Indian & Chinese Restaurant Menu")
with gr.Row():
for item in menu_data.keys():
gr.Button(item).click(
display_card, inputs=[item], outputs=gr.HTML()
)
app.launch()
|