Spaces:
Build error
Build error
Update app.py
Browse files33 unmodified lines343536373839404115 unmodified lines575859606162636 unmodified lines707172737475767722 unmodified lines10010110210310410510610710810911011130 unmodified lines1421431441451461471481491501511529 unmodified lines16216316416516616716816917017117217317417533 unmodified lines</div><div style="flex-shrink: 0; text-align: center;"><img src="{item['Image URL']}" alt="{item['Dish Name']}" style="width: 100px; height: 100px; border-radius: 8px; object-fit: cover; margin-bottom: 10px;"><button style="background-color: #28a745; color: white; border: none; padding: 8px 15px; font-size: 14px; border-radius: 5px; cursor: pointer;"value="{item['Dish Name']}">Add</button></div></div>"""15 unmodified lines# Gradio app definitiondef app():with gr.Blocks(title="Dynamic Menu with Filters") as demo:gr.Markdown("## Dynamic Menu with Preferences")# Radio button for selecting preference6 unmodified lines# Main menu output areamenu_output = gr.HTML(value=filter_menu("All"), visible=True)# Detailed view componentsdetailed_view = gr.Column(visible=False)dish_image = gr.Image()dish_name = gr.Markdown()dish_description = gr.Markdown()22 unmodified linesdef update_menu(preference):return filter_menu(preference)def show_dish_details(dish_name):try:img, name, desc, price = render_dish_details(dish_name)return (gr.update(visible=False), # Hide menugr.update(visible=True), # Show detailed viewimg,name,desc,30 unmodified lines)menu_output.change(show_dish_details,inputs=[menu_output],outputs=[menu_output,detailed_view,dish_image,dish_name,dish_description,9 unmodified linesback_button.click(lambda: (gr.update(visible=True), gr.update(visible=False)),outputs=[menu_output, detailed_view],)# Layoutwith gr.Row(visible=True):menu_outputwith detailed_view:dish_imagedish_namedish_description33 unmodified lines34353637383940414215 unmodified lines585960616263646 unmodified lines717273747576777822 unmodified lines10110210310410510610710810911011111230 unmodified lines1431441451461471481491501511521539 unmodified lines16316416516616716816917017117217317417517633 unmodified lines</div><div style="flex-shrink: 0; text-align: center;"><img src="{item['Image URL']}" alt="{item['Dish Name']}" style="width: 100px; height: 100px; border-radius: 8px; object-fit: cover; margin-bottom: 10px;"><button value="{item['Dish Name']}" style="background-color: #28a745; color: white; border: none; padding: 8px 15px; font-size: 14px; border-radius: 5px; cursor: pointer;">View Details</button></div></div>"""15 unmodified lines# Gradio app definitiondef app():with gr.Blocks(title="Dynamic Menu with Suggestions Page") as demo:gr.Markdown("## Dynamic Menu with Preferences")# Radio button for selecting preference6 unmodified lines# Main menu output areamenu_output = gr.HTML(value=filter_menu("All"), visible=True)# Suggestion page componentssuggestion_page = gr.Column(visible=False)dish_image = gr.Image()dish_name = gr.Markdown()dish_description = gr.Markdown()22 unmodified linesdef update_menu(preference):return filter_menu(preference)def show_suggestion_page(dish_name):try:img, name, desc, price = render_dish_details(dish_name)return (gr.update(visible=False), # Hide menugr.update(visible=True), # Show suggestion pageimg,name,desc,30 unmodified lines)menu_output.change(show_suggestion_page,inputs=[menu_output],outputs=[menu_output,suggestion_page,dish_image,dish_name,dish_description,9 unmodified linesback_button.click(lambda: (gr.update(visible=True), gr.update(visible=False)),outputs=[menu_output, suggestion_page],)# Layoutwith gr.Row(visible=True):menu_outputwith suggestion_page:dish_imagedish_namedish_description
app.py+12-11