Spaces:
Sleeping
Sleeping
Update app.py
Browse files
app.py
CHANGED
|
@@ -80,7 +80,7 @@ header {
|
|
| 80 |
box-shadow: 0 4px 15px rgba(0, 0, 0, 0.2);
|
| 81 |
}
|
| 82 |
|
| 83 |
-
.
|
| 84 |
border: 2px solid #ff7eb3;
|
| 85 |
background: rgba(255, 255, 255, 0.8);
|
| 86 |
border-radius: 15px;
|
|
@@ -97,27 +97,4 @@ 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
|
| 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 |
-
chatbot_output = gr.Chatbot(label="Chat History", css_class="chatbot-output")
|
| 109 |
-
|
| 110 |
-
# Add functionality to handle interactions
|
| 111 |
-
def handle_chat(user_input, category, history):
|
| 112 |
-
if not user_input.strip():
|
| 113 |
-
return history, history
|
| 114 |
-
updated_history, _ = chatbot(user_input, category, history)
|
| 115 |
-
return updated_history, updated_history
|
| 116 |
-
|
| 117 |
-
send_button.click(
|
| 118 |
-
handle_chat,
|
| 119 |
-
inputs=[user_input, category_dropdown, chatbot_output],
|
| 120 |
-
outputs=[chatbot_output, chatbot_output]
|
| 121 |
-
)
|
| 122 |
-
|
| 123 |
-
chat_interface.launch()
|
|
|
|
| 80 |
box-shadow: 0 4px 15px rgba(0, 0, 0, 0.2);
|
| 81 |
}
|
| 82 |
|
| 83 |
+
.chat-container {
|
| 84 |
border: 2px solid #ff7eb3;
|
| 85 |
background: rgba(255, 255, 255, 0.8);
|
| 86 |
border-radius: 15px;
|
|
|
|
| 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
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|