import gradio as gr | |
# Function to recommend dishes based on preferences | |
def recommend_dishes(preferences): | |
# Basic logic to recommend dishes (in reality, it could query a database) | |
if "vegan" in preferences.lower(): | |
return "Recommended Vegan Dishes: Vegan Pizza, Vegan Burger" | |
elif "spicy" in preferences.lower(): | |
return "Recommended Spicy Dishes: Spicy Chicken Wings, Spicy Tacos" | |
else: | |
return "Recommended Dishes: Margherita Pizza, Caesar Salad" | |
# Gradio interface for the interactive menu system | |
with gr.Blocks() as menu_app: | |
preferences = gr.Textbox(label="Enter your dietary preferences (e.g., vegan, spicy)") | |
recommend_button = gr.Button("Get Recommendations") | |
recommendations_output = gr.Textbox(label="Recommended Dishes") | |
recommend_button.click(fn=recommend_dishes, inputs=preferences, outputs=recommendations_output) | |
menu_app.launch() | |