nagasurendra's picture
Update app.py
4a00b98 verified
raw
history blame
2.15 kB
import os
import sys
import gradio as gr
# Add the current working directory to Python's module search path
current_dir = os.path.dirname(os.path.abspath(__file__))
if current_dir not in sys.path:
sys.path.insert(0, current_dir)
# Debugging paths
routes_dir = os.path.join(current_dir, "routes")
auth_file_path = os.path.join(routes_dir, "auth.py")
print("DEBUG: Does 'routes' directory exist? ", os.path.exists(routes_dir))
print("DEBUG: Does 'auth.py' exist in 'routes'? ", os.path.exists(auth_file_path))
# Import necessary modules
try:
from routes.auth import login, sign_up
from routes.menu import load_menu
from routes.orders import add_to_order, view_order, place_order
from utils.file_initializer import initialize_files
except ModuleNotFoundError as e:
print(f"ERROR: {e}")
sys.exit(1)
# Initialize necessary files
initialize_files()
def restaurant_interface():
with gr.Blocks() as app:
# Title or Header
gr.Markdown("# Welcome to BH Restaurant")
# Login/Sign-up Section
with gr.Row():
with gr.Column():
gr.Textbox(label="Email", placeholder="Enter your email")
gr.Textbox(label="Password", placeholder="Enter your password", type="password")
gr.Button("Login")
with gr.Column():
gr.Markdown("### New Customer?")
gr.Button("Sign Up")
# Menu Section
with gr.Row():
gr.Markdown("## Menu")
gr.Textbox(label="Search Menu", placeholder="Search for a dish")
# Add Menu Items Dynamically
with gr.Row():
gr.Markdown("### Popular Items")
gr.Button("Add Paneer Tikka")
gr.Button("Add Chicken Biryani")
gr.Button("Add Garlic Naan")
# Orders Section
with gr.Row():
gr.Markdown("## Your Order")
gr.Textbox(label="Order Summary", placeholder="Your selected items will appear here", lines=5)
gr.Button("Place Order")
return app
if __name__ == "__main__":
app = restaurant_interface()
app.launch()