CoolFace
Apppublic

Wanswan/restaurantmenudemo

sourceHugging Facemitupdated 1y agoView on Hugging Face
0likes
app.py181 linesDownload Raw Back to root
1import gradio as gr2import re  # For regex operations3from functools import partial4import pandas as pd5 6# The menu definition with corrected commas and extras.7menu = {8    "Starters": [9        {10            "name": "A111 - Summer Rolls (Vegan)",11            "description": (12                "Rice paper, fresh carrots, cucumbers, with mint, cilantro rolled with rice noodles and tofu."13                " Served with Hoisin and peanut butter sauce."14            ),15            "price": "πŸ’°5.50 €/ 2 rolls",16            "image": "https://i.pinimg.com/736x/4f/98/cc/4f98cc73eb9574447adafa4473465bcd.jpg",17        },18        {19            "name": "A2 - Papaya Salad (Vegan)",20            "description": (21                "Green papaya salad mixed with crunchy raw veggies, roasted peanuts, fried shallots "22                "and tossed with a bright and citrusy lime dressing."23            ),24            "price": "πŸ’°8.90 €",25            "image": "https://product.hstatic.net/200000294248/product/xoai_du_du_tom_kho_9db38fcb08024d3ebb4933a92a8e7728_1024x1024.jpg",26        },27        {28            "name": "A3 - Pork & Shrimp Summer Rolls",29            "description": (30                "Rice paper wrappers, rice vermicelli noodles, cooked pork and shrimp, rolled with fresh "31                "lettuce, mint, cilantro, and cucumbers. Served with Hoisin peanut sauce or fish sauce."32            ),33            "price": "πŸ’°7.50 €/ 3 rolls",34            "image": "https://cdn.netspace.edu.vn/images/2020/04/25/cach-lam-goi-cuon-tom-thit-cuc-ki-hap-dan-245587-800.jpg",35        },36        {37            "name": "A4 - Chicken Spring Rolls",38            "description": (39                "Vietnamese deep-fried spring roll filled with ground chicken, vermicelli noodles, and "40                "minced wood ear mushroom. Served with fish sauce"41            ),42            "price": "πŸ’°6.50 €/ 3 sticks",43            "image": "https://i-giadinh.vnecdn.net/2024/12/05/Thnhphm11-1733391139-5608-1733391142.jpg",44        },45        {46            "name": "A5 - Rare Beef Salad",47            "description": (48                "Vietnamese rare beef salad - typically features thinly sliced rare beef, mixed with fish "49                "sauce, lime juice, sugar, and a variety of fresh herbs, vegetables, spices and served "50                "together with prawn crackers."51            ),52            "price": "πŸ’°10.50 €",53            "image": "https://i.ytimg.com/vi/KWpZc0f9smI/maxresdefault.jpg",54        },55    ],56    "Main Courses": [57        {58            "name": "B1 - Bun Tron Chay Tofu (Vegan)",59            "description": (60                "Pan-fried Tofu with lemongrass, leeks, and bean sprouts on lukewarm rice noodles, "61                "served with fresh herbs and sweet and sour fish sauce"62            ),63            "price": "πŸ’°13.90 €",64            "image": "https://img-global.cpcdn.com/recipes/e7b6be2dd3c9aa41/680x781cq80/bun-g%E1%BA%A1o-l%E1%BB%A9t-tr%E1%BB%99n-chay-recipe-main-photo.jpg",65        },66        {67            "name": "B2 - Bun Dau (Vegan)",68            "description": (69                "Rice vermicelli, served with deep-fried tofu, fresh herbs, cucumber, fried vegan "70                "spring rolls, dipped with vegan fish sauce, chili, and lime juice."71            ),72            "price": "πŸ’°13.90 €",73            "image": "https://i.ytimg.com/vi/TJJ6aHIXoT8/hq720.jpg?sqp=-oaymwEhCK4FEIIDSFryq4qpAxMIARUAAAAAGAElAADIQj0AgKJD&rs=AOn4CLCx4BA_0ht5p02grA8ieWohFiBByQ",74        },75        {76            "name": "B3 - Bun Cha Ha Noi",77            "description": (78                "Northern Vietnamese dish features charred pork patties and pork belly slices bathed in "79                "a steaming dipping sauce served alongside tender rice noodles, fresh herbs, and "80                "crunchy pickles."81            ),82            "price": "πŸ’°15.90 €",83            "image": "https://daiductai.vn/upload/filemanager/B%C3%BAn%20ch%E1%BA%A3/bun-cha.jpg",84        },85        {86            "name": "B4 - Hoi An Chicken Rice",87            "description": (88                "Free-range chicken, jasmine rice, fresh herbs, crispy fried shallots, chili satay. "89                "Served with shredded green papaya, carrots, daikon, and Vietnamese mint, accompanied "90                "by a sweet and sour fish sauce and a side bowl of chicken broth."91            ),92            "price": "πŸ’°14.90 €",93            "image": "https://i-giadinh.vnecdn.net/2023/04/22/Buoc-11-thanh-pham-1-11-9981-1682135995.jpg",94        },95        {96            "name": "B5 - Pho Bo",97            "description": "Rice noodles in beef broth with rare beef and herbs on top.",98            "price": "πŸ’°15.90 €",99            "image": "https://phothaihung.com/wp-content/uploads/2023/11/pho-nha-lam.jpg",100        },101    ],102    "Coffee & tea": [103        {104            "name": "C1 - Peach & Orange Lemongrass Iced Tea",105            "description": "",106            "price": "πŸ’°5.50 €",107            "image": "https://data.thefeedfeed.com/static/2019/09/10/15681428875d77f627a3522.jpg",108        },109        {110            "name": "C2 - Jasmine Lime-Lychee Iced Tea",111            "description": "",112            "price": "πŸ’°5.50 €",113            "image": "https://goodfoodbaddie.com/wp-content/uploads/2023/06/lychee-iced-tea.jpg",114        },115        {116            "name": "C3 - Ice Vietnamese Coffee With Condensed Milk",117            "description": "",118            "price": "πŸ’°5.90 €",119            "image": "https://www.pho9co.com/wp-content/uploads/2024/01/vietnamese-condensed-milk-1024x800.jpg",120        },121        {122            "name": "C4 - Cola/Cola Zero/Fanta/Sprite or Mineral Water/Sparking Water (0.2L)",123            "description": "",124            "price": "πŸ’°2.50 €",125            "image": "https://burgernj.com/wp-content/uploads/2021/05/Soft-Drinks_result.jpg",126        },127        {128            "name": "C5 - Gaffel KΓΆlnsch (0.33L)",129            "description": "",130            "price": "πŸ’°2.60 €",131            "image": "https://beertasting.app/storage/media/1ad9abc052554acb358f99be359a05ec/b3zjsb81ofhgioz7mnaa.jpeg",132        },133    ],134}135 136# 强刢 Tabs ζ¨ͺε‘ζ»šεŠ¨δΈζ’θ‘Œηš„ CSS137css = """138<style>139footer, .svelte-1ipelgc { display: none !important; }140 141.tabs.svelte-1ipelgc {142    flex-wrap: nowrap !important;143    overflow-x: auto !important;144    white-space: nowrap !important;145}146.tabitem.svelte-1ipelgc {147    font-size: 15px !important;148    flex: 0 0 auto !important;149    padding: 8px 16px !important;150}151</style>152"""153 154with gr.Blocks() as demo:155    gr.Markdown("# 🍜πŸ₯’ EAT EAT Cafe & Bistro")156    gr.HTML(css)157 158    gr.Markdown(159        "Your task: One starter containing mushroom, One main course containing beef; One drink that is the cheapest on the menu."160    )161 162    with gr.Tabs():163        for category, items in menu.items():164            with gr.TabItem(category):165                for item in items:166                    with gr.Row():167                        with gr.Column(scale=1):168                            gr.HTML(169                                f"<img src='{item.get('image', '')}' style='height:90px;width:120px;border-radius:8px;'/>"170                            )171                        with gr.Column(scale=4):172                            name = item["name"]173                            desc = item["description"]174                            price = item["price"]175                            gr.Markdown(176                                f"**{name}**\n\n{desc}\n\n<span style='color:green;font-weight:bold'>{price}</span>",177                                show_label=False,178                            )179 180if __name__ == "__main__":181    demo.launch()