Spaces:
Runtime error
Runtime error
Update app.py
Browse files
app.py
CHANGED
@@ -1,27 +1,24 @@
|
|
|
|
1 |
import gradio as gr
|
2 |
-
import speech_recognition as sr
|
3 |
|
4 |
-
def
|
5 |
-
#
|
6 |
-
|
|
|
|
|
|
|
|
|
|
|
7 |
|
8 |
-
|
9 |
-
|
10 |
-
with
|
11 |
-
|
12 |
-
|
13 |
-
|
14 |
-
|
15 |
-
|
16 |
-
|
|
|
17 |
|
18 |
-
|
19 |
-
iface = gr.Interface(
|
20 |
-
fn=voice_booking,
|
21 |
-
inputs=gr.inputs.Audio(),
|
22 |
-
outputs="text",
|
23 |
-
title="Hotel Booking Chatbot",
|
24 |
-
description="Use voice or text to book a hotel",
|
25 |
-
)
|
26 |
-
|
27 |
-
iface.launch()
|
|
|
1 |
+
# app.py
|
2 |
import gradio as gr
|
|
|
3 |
|
4 |
+
def chatbot_response(message):
|
5 |
+
# Simple response logic
|
6 |
+
responses = {
|
7 |
+
"book a hotel": "Sure! What date and location?",
|
8 |
+
"check availability": "Let me check the availability...",
|
9 |
+
"hotel pricing": "Here are the pricing options...",
|
10 |
+
}
|
11 |
+
return responses.get(message.lower(), "Sorry, I didn't understand that.")
|
12 |
|
13 |
+
with gr.Blocks() as chatbot:
|
14 |
+
gr.Markdown("# Hotel Booking Chatbot")
|
15 |
+
with gr.Row():
|
16 |
+
message_input = gr.Textbox(label="Your Message")
|
17 |
+
with gr.Row():
|
18 |
+
submit_button = gr.Button("Send")
|
19 |
+
with gr.Row():
|
20 |
+
output = gr.Textbox(label="Chatbot Response")
|
21 |
+
|
22 |
+
submit_button.click(chatbot_response, inputs=message_input, outputs=output)
|
23 |
|
24 |
+
chatbot.launch()
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|