Spaces:
Build error
Build error
File size: 1,321 Bytes
07de9e8 3d3c5c6 2680d6c 3d3c5c6 db61a2b 3d3c5c6 2680d6c db61a2b 3d3c5c6 |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 |
import gradio as gr
import asyncio
from order_assistant import OrderAssistant, load_food_menu # Import OrderAssistant and load_food_menu
# Load the food menu from the menu.json file
food_menu = load_food_menu()
# Initialize the food order assistant with the food menu
order_assistant = OrderAssistant(food_menu)
# Gradio interface function
async def food_order_interface(audio_input, food_type):
audio, order_details = await order_assistant.food_order_assistant(audio_input, food_type)
return audio, order_details
# Create Gradio application
async def create_demo():
demo = gr.Interface(fn=food_order_interface,
inputs=[gr.Audio(type="filepath", label="Order Food"), # Microphone input for audio file
gr.Dropdown(choices=["Starters", "Main Course", "Desserts"], label="Food Type")],
outputs=[gr.Audio(label="Order Confirmation Audio"),
gr.Textbox(label="Confirmed Order Details", interactive=False)],
title="AI Restaurant Voice Ordering",
description="Order food easily with the AI assistant's voice ordering system.")
return demo
# Run the application
if __name__ == "__main__":
demo = asyncio.run(create_demo())
demo.launch()
|