Spaces:
Runtime error
Runtime error
Update app.py
Browse files
app.py
CHANGED
@@ -1,24 +1,21 @@
|
|
1 |
-
# app.py
|
2 |
import gradio as gr
|
|
|
3 |
|
4 |
-
|
5 |
-
|
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 |
-
|
14 |
-
|
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 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
import gradio as gr
|
2 |
+
from models.hotel_booking_model import HotelBookingAgent
|
3 |
|
4 |
+
# Create an instance of the chatbot model
|
5 |
+
model = HotelBookingAgent()
|
|
|
|
|
|
|
|
|
|
|
|
|
6 |
|
7 |
+
def chatbot_function(user_input):
|
8 |
+
return model.generate_response(user_input)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
9 |
|
10 |
+
# Gradio interface
|
11 |
+
iface = gr.Interface(
|
12 |
+
fn=chatbot_function,
|
13 |
+
inputs=["text", "audio"],
|
14 |
+
outputs=["text"],
|
15 |
+
live=True,
|
16 |
+
title="Hotel Booking Chatbot",
|
17 |
+
description="Ask about hotel bookings with voice or text input",
|
18 |
+
theme="huggingface"
|
19 |
+
)
|
20 |
+
|
21 |
+
iface.launch()
|