|
|
import gradio as gr |
|
|
return f"Command not recognized: {command}" |
|
|
|
|
|
|
|
|
menu_interface = gr.Interface( |
|
|
fn=get_menu, |
|
|
inputs=None, |
|
|
outputs="json", |
|
|
description="Get the menu." |
|
|
) |
|
|
|
|
|
order_interface = gr.Interface( |
|
|
fn=place_order, |
|
|
inputs=["text", "text"], |
|
|
outputs="text", |
|
|
description="Place an order by providing a comma-separated list of items and customizations." |
|
|
) |
|
|
|
|
|
speak_interface = gr.Interface( |
|
|
fn=text_to_speech, |
|
|
inputs="text", |
|
|
outputs="text", |
|
|
description="Convert text to speech." |
|
|
) |
|
|
|
|
|
speech_recognition_interface = gr.Interface( |
|
|
fn=live_speech, |
|
|
inputs=None, |
|
|
outputs="text", |
|
|
description="Speak commands like 'Show menu' or 'Order Biryani'." |
|
|
) |
|
|
|
|
|
|
|
|
app = gr.TabbedInterface([ |
|
|
menu_interface, |
|
|
order_interface, |
|
|
speak_interface, |
|
|
speech_recognition_interface |
|
|
], ["Menu", "Order", "Speak", "Voice Commands"]) |
|
|
|
|
|
if __name__ == "__main__": |
|
|
app.launch() |