|
import os |
|
import sys |
|
import gradio as gr |
|
|
|
|
|
current_dir = os.path.dirname(os.path.abspath(__file__)) |
|
if current_dir not in sys.path: |
|
sys.path.insert(0, current_dir) |
|
|
|
|
|
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)) |
|
|
|
|
|
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_files() |
|
|
|
def restaurant_interface(): |
|
with gr.Blocks() as app: |
|
|
|
gr.Markdown("# Welcome to BH Restaurant") |
|
|
|
|
|
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") |
|
|
|
|
|
with gr.Row(): |
|
gr.Markdown("## Menu") |
|
gr.Textbox(label="Search Menu", placeholder="Search for a dish") |
|
|
|
|
|
with gr.Row(): |
|
gr.Markdown("### Popular Items") |
|
gr.Button("Add Paneer Tikka") |
|
gr.Button("Add Chicken Biryani") |
|
gr.Button("Add Garlic Naan") |
|
|
|
|
|
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() |
|
|