Spaces:
Sleeping
Sleeping
Update app.py
Browse files
app.py
CHANGED
@@ -97,4 +97,28 @@ with chat_interface:
|
|
97 |
with gr.Row():
|
98 |
gr.Markdown("<p style='text-align:center;'>Select a category and type your message to get tailored responses.</p>")
|
99 |
with gr.Row():
|
100 |
-
user_input = gr.Textbox(label="Your Message", placeholder="Type something...", lines
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
97 |
with gr.Row():
|
98 |
gr.Markdown("<p style='text-align:center;'>Select a category and type your message to get tailored responses.</p>")
|
99 |
with gr.Row():
|
100 |
+
user_input = gr.Textbox(label="Your Message", placeholder="Type something...", lines=2)
|
101 |
+
category_dropdown = gr.Dropdown(
|
102 |
+
choices=["Stress Management", "Career Advice", "General", "Friendly Buddy"],
|
103 |
+
label="Choose Chat Category"
|
104 |
+
)
|
105 |
+
with gr.Row():
|
106 |
+
send_button = gr.Button("Send")
|
107 |
+
with gr.Row():
|
108 |
+
with gr.Box(css_classes="chat-container"):
|
109 |
+
chatbot_output = gr.Chatbot(label="Chat History")
|
110 |
+
|
111 |
+
# Add functionality to handle interactions
|
112 |
+
def handle_chat(user_input, category, history):
|
113 |
+
if not user_input.strip():
|
114 |
+
return history, history
|
115 |
+
updated_history, _ = chatbot(user_input, category, history)
|
116 |
+
return updated_history, updated_history
|
117 |
+
|
118 |
+
send_button.click(
|
119 |
+
handle_chat,
|
120 |
+
inputs=[user_input, category_dropdown, chatbot_output],
|
121 |
+
outputs=[chatbot_output, chatbot_output]
|
122 |
+
)
|
123 |
+
|
124 |
+
chat_interface.launch()
|