Spaces:
Runtime error
Runtime error
File size: 1,889 Bytes
6011c2a ea900d6 1b335cb ea900d6 1b335cb 185e476 ea900d6 59bb4d9 ea900d6 1b335cb 59bb4d9 ea900d6 1b335cb ea900d6 1b335cb 59bb4d9 |
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 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 |
import gradio as gr
# Menu data
menu_items = [
{
"name": "Crostini Caprese",
"price": "₹260",
"image": "static/CrostiniCaprese.jpg",
"rating": "2.9",
"reviews": "10",
"description": "Tomatoes, olive oil, basil and mozzarella",
"customizable": True,
},
{
"name": "Margherita Pizza",
"price": "₹500",
"image": "static/MargheritaPizza.jpg",
"rating": "4.5",
"reviews": "120",
"description": "Classic margherita pizza with fresh tomatoes and basil",
"customizable": False,
},
]
# Gradio app
with gr.Blocks() as app:
gr.Markdown("## Recommended (20)")
for item in menu_items:
with gr.Row():
with gr.Column(scale=3):
gr.Markdown(f"""
**{item['name']}**
{item['price']}
⭐ **{item['rating']}** ({item['reviews']})
_{item['description']}_
""")
with gr.Column(scale=1, align="center"):
gr.Image(value=item["image"], label="", elem_id="menu-image", show_label=False)
gr.Button("ADD", elem_id="add-button")
if item["customizable"]:
gr.Markdown("Customisable", elem_id="customisable-text")
# Add styles for better presentation
gr.CSS("""
#menu-image {
width: 100px;
height: auto;
border-radius: 10px;
margin: 5px auto;
}
#add-button {
background-color: #34c759;
color: white;
font-weight: bold;
border-radius: 20px;
padding: 10px;
width: 100%;
}
#customisable-text {
text-align: center;
font-size: 12px;
color: grey;
}
""")
app.launch()
|