Spaces:
Build error
Build error
Update app.py
Browse files1234567891011121314151617186 unmodified lines252627282930316 unmodified lines383940414243import pandas as pdimport gradio as gr# Load the menu data from the Excel filedef load_menu(file_path="menu.xlsx"):menu_data = pd.read_excel(file_path)required_columns = ["Category", "Dish Name", "Price", "Image URL", "Description", "Ingredients", "Allergen Info", "Recommended Items", "Spice Levels"]# Check for missing columnsmissing_columns = [col for col in required_columns if col not in menu_data.columns]if missing_columns:raise ValueError(f"Missing columns in Excel file: {missing_columns}")return menu_dataif preference != "All":filtered_data = menu_data[menu_data["Category"] == preference]else:6 unmodified lines<div style="display: flex; align-items: center; border: 1px solid #ddd; border-radius: 8px; padding: 15px; margin-bottom: 10px; box-shadow: 0px 4px 8px rgba(0, 0, 0, 0.1);"><div style="flex: 1; margin-right: 15px;"><h3 style="margin: 0; font-size: 18px;">{item['Dish Name']}</h3><p style="margin: 5px 0; font-size: 16px; color: #888;">₹{item['Price']}</p><p style="margin: 5px 0; font-size: 14px; color: #555;">{item['Description']}</p></div><div style="flex-shrink: 0; text-align: center;">6 unmodified lines# Gradio app definitiondef app():preferences = ["All", "Vegan", "Halal", "Guilt-Free"]with gr.Blocks() as demo:12345678910111213141516171819202122232425266 unmodified lines333435363738396 unmodified lines46474849505152import pandas as pdimport gradio as gr# Function to load menu datadef load_menu(file_path="menu.xlsx"):try:menu_data = pd.read_excel(file_path)return menu_dataexcept FileNotFoundError:raise FileNotFoundError("The menu.xlsx file was not found. Ensure it is in the same directory as app.py.")# Function to filter the menu based on preferencedef filter_menu(preference):# Load menu datamenu_data = load_menu()# Check for the required columnsrequired_columns = ["Category", "Dish Name", "Price", "Image URL", "Description"]for col in required_columns:if col not in menu_data.columns:raise ValueError(f"Missing column in Excel file: {col}")# Filter data based on preferenceif preference != "All":filtered_data = menu_data[menu_data["Category"] == preference]else:6 unmodified lines<div style="display: flex; align-items: center; border: 1px solid #ddd; border-radius: 8px; padding: 15px; margin-bottom: 10px; box-shadow: 0px 4px 8px rgba(0, 0, 0, 0.1);"><div style="flex: 1; margin-right: 15px;"><h3 style="margin: 0; font-size: 18px;">{item['Dish Name']}</h3><p style="margin: 5px 0; font-size: 16px; color: #888;">${item['Price']}</p><p style="margin: 5px 0; font-size: 14px; color: #555;">{item['Description']}</p></div><div style="flex-shrink: 0; text-align: center;">6 unmodified lines# Gradio app definitiondef app():# Menu preferencespreferences = ["All", "Vegan", "Halal", "Guilt-Free"]with gr.Blocks() as demo:
app.py+20-11