import gradio as gr import re # For regex operations from functools import partial import pandas as pd # The menu definition with corrected commas and extras. menu = { "Starters": [ { "name": "A111 - Summer Rolls (Vegan)", "description": ( "Rice paper, fresh carrots, cucumbers, with mint, cilantro rolled with rice noodles and tofu." " Served with Hoisin and peanut butter sauce." ), "price": "πŸ’°5.50 €/ 2 rolls", "image": "https://i.pinimg.com/736x/4f/98/cc/4f98cc73eb9574447adafa4473465bcd.jpg", }, { "name": "A2 - Papaya Salad (Vegan)", "description": ( "Green papaya salad mixed with crunchy raw veggies, roasted peanuts, fried shallots " "and tossed with a bright and citrusy lime dressing." ), "price": "πŸ’°8.90 €", "image": "https://product.hstatic.net/200000294248/product/xoai_du_du_tom_kho_9db38fcb08024d3ebb4933a92a8e7728_1024x1024.jpg", }, { "name": "A3 - Pork & Shrimp Summer Rolls", "description": ( "Rice paper wrappers, rice vermicelli noodles, cooked pork and shrimp, rolled with fresh " "lettuce, mint, cilantro, and cucumbers. Served with Hoisin peanut sauce or fish sauce." ), "price": "πŸ’°7.50 €/ 3 rolls", "image": "https://cdn.netspace.edu.vn/images/2020/04/25/cach-lam-goi-cuon-tom-thit-cuc-ki-hap-dan-245587-800.jpg", }, { "name": "A4 - Chicken Spring Rolls", "description": ( "Vietnamese deep-fried spring roll filled with ground chicken, vermicelli noodles, and " "minced wood ear mushroom. Served with fish sauce" ), "price": "πŸ’°6.50 €/ 3 sticks", "image": "https://i-giadinh.vnecdn.net/2024/12/05/Thnhphm11-1733391139-5608-1733391142.jpg", }, { "name": "A5 - Rare Beef Salad", "description": ( "Vietnamese rare beef salad - typically features thinly sliced rare beef, mixed with fish " "sauce, lime juice, sugar, and a variety of fresh herbs, vegetables, spices and served " "together with prawn crackers." ), "price": "πŸ’°10.50 €", "image": "https://i.ytimg.com/vi/KWpZc0f9smI/maxresdefault.jpg", }, ], "Main Courses": [ { "name": "B1 - Bun Tron Chay Tofu (Vegan)", "description": ( "Pan-fried Tofu with lemongrass, leeks, and bean sprouts on lukewarm rice noodles, " "served with fresh herbs and sweet and sour fish sauce" ), "price": "πŸ’°13.90 €", "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", }, { "name": "B2 - Bun Dau (Vegan)", "description": ( "Rice vermicelli, served with deep-fried tofu, fresh herbs, cucumber, fried vegan " "spring rolls, dipped with vegan fish sauce, chili, and lime juice." ), "price": "πŸ’°13.90 €", "image": "https://i.ytimg.com/vi/TJJ6aHIXoT8/hq720.jpg?sqp=-oaymwEhCK4FEIIDSFryq4qpAxMIARUAAAAAGAElAADIQj0AgKJD&rs=AOn4CLCx4BA_0ht5p02grA8ieWohFiBByQ", }, { "name": "B3 - Bun Cha Ha Noi", "description": ( "Northern Vietnamese dish features charred pork patties and pork belly slices bathed in " "a steaming dipping sauce served alongside tender rice noodles, fresh herbs, and " "crunchy pickles." ), "price": "πŸ’°15.90 €", "image": "https://daiductai.vn/upload/filemanager/B%C3%BAn%20ch%E1%BA%A3/bun-cha.jpg", }, { "name": "B4 - Hoi An Chicken Rice", "description": ( "Free-range chicken, jasmine rice, fresh herbs, crispy fried shallots, chili satay. " "Served with shredded green papaya, carrots, daikon, and Vietnamese mint, accompanied " "by a sweet and sour fish sauce and a side bowl of chicken broth." ), "price": "πŸ’°14.90 €", "image": "https://i-giadinh.vnecdn.net/2023/04/22/Buoc-11-thanh-pham-1-11-9981-1682135995.jpg", }, { "name": "B5 - Pho Bo", "description": "Rice noodles in beef broth with rare beef and herbs on top.", "price": "πŸ’°15.90 €", "image": "https://phothaihung.com/wp-content/uploads/2023/11/pho-nha-lam.jpg", }, ], "Coffee & tea": [ { "name": "C1 - Peach & Orange Lemongrass Iced Tea", "description": "", "price": "πŸ’°5.50 €", "image": "https://data.thefeedfeed.com/static/2019/09/10/15681428875d77f627a3522.jpg", }, { "name": "C2 - Jasmine Lime-Lychee Iced Tea", "description": "", "price": "πŸ’°5.50 €", "image": "https://goodfoodbaddie.com/wp-content/uploads/2023/06/lychee-iced-tea.jpg", }, { "name": "C3 - Ice Vietnamese Coffee With Condensed Milk", "description": "", "price": "πŸ’°5.90 €", "image": "https://www.pho9co.com/wp-content/uploads/2024/01/vietnamese-condensed-milk-1024x800.jpg", }, { "name": "C4 - Cola/Cola Zero/Fanta/Sprite or Mineral Water/Sparking Water (0.2L)", "description": "", "price": "πŸ’°2.50 €", "image": "https://burgernj.com/wp-content/uploads/2021/05/Soft-Drinks_result.jpg", }, { "name": "C5 - Gaffel KΓΆlnsch (0.33L)", "description": "", "price": "πŸ’°2.60 €", "image": "https://beertasting.app/storage/media/1ad9abc052554acb358f99be359a05ec/b3zjsb81ofhgioz7mnaa.jpeg", }, ], } # 强刢 Tabs ζ¨ͺε‘ζ»šεŠ¨δΈζ’θ‘Œηš„ CSS css = """ """ with gr.Blocks() as demo: gr.Markdown("# 🍜πŸ₯’ EAT EAT Cafe & Bistro") gr.HTML(css) gr.Markdown( "Your task: One starter containing mushroom, One main course containing beef; One drink that is the cheapest on the menu." ) with gr.Tabs(): for category, items in menu.items(): with gr.TabItem(category): for item in items: with gr.Row(): with gr.Column(scale=1): gr.HTML( f"" ) with gr.Column(scale=4): name = item["name"] desc = item["description"] price = item["price"] gr.Markdown( f"**{name}**\n\n{desc}\n\n{price}", show_label=False, ) if __name__ == "__main__": demo.launch()