Update app.py
Browse files
app.py
CHANGED
|
@@ -1,4 +1,3 @@
|
|
| 1 |
-
|
| 2 |
import gradio as gr
|
| 3 |
import logging
|
| 4 |
import os
|
|
@@ -204,7 +203,6 @@ with gr.Blocks(title="Company Documents Q&A Chatbot", theme=gr.themes.Soft()) as
|
|
| 204 |
lines=1,
|
| 205 |
interactive=True,
|
| 206 |
elem_id="user-question",
|
| 207 |
-
visible=True
|
| 208 |
)
|
| 209 |
with gr.Column(scale=1):
|
| 210 |
submit_btn = gr.Button("Submit", variant="primary", elem_id="submit-btn")
|
|
@@ -223,4 +221,66 @@ with gr.Blocks(title="Company Documents Q&A Chatbot", theme=gr.themes.Soft()) as
|
|
| 223 |
|
| 224 |
submit_btn.click(fn=process_question, inputs=[question, chat_history], outputs=[chat_history, conf_out, source_out, record_out])
|
| 225 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 226 |
demo.launch(server_name="0.0.0.0", server_port=7860, share=True)
|
|
|
|
|
|
|
| 1 |
import gradio as gr
|
| 2 |
import logging
|
| 3 |
import os
|
|
|
|
| 203 |
lines=1,
|
| 204 |
interactive=True,
|
| 205 |
elem_id="user-question",
|
|
|
|
| 206 |
)
|
| 207 |
with gr.Column(scale=1):
|
| 208 |
submit_btn = gr.Button("Submit", variant="primary", elem_id="submit-btn")
|
|
|
|
| 221 |
|
| 222 |
submit_btn.click(fn=process_question, inputs=[question, chat_history], outputs=[chat_history, conf_out, source_out, record_out])
|
| 223 |
|
| 224 |
+
# --- CSS for VFX Styles ---
|
| 225 |
+
demo.css = """
|
| 226 |
+
/* Chatbot Container */
|
| 227 |
+
#chatbox {
|
| 228 |
+
background-color: #f9f9f9;
|
| 229 |
+
border-radius: 12px;
|
| 230 |
+
box-shadow: 0 4px 10px rgba(0, 0, 0, 0.1);
|
| 231 |
+
padding: 15px;
|
| 232 |
+
overflow-y: auto;
|
| 233 |
+
}
|
| 234 |
+
|
| 235 |
+
/* User and Bot message bubbles */
|
| 236 |
+
.gradio-chatbot-message-user {
|
| 237 |
+
background-color: #0d6efd;
|
| 238 |
+
color: white;
|
| 239 |
+
border-radius: 15px;
|
| 240 |
+
padding: 10px;
|
| 241 |
+
margin: 5px 0;
|
| 242 |
+
animation: fadeIn 0.5s ease-in-out;
|
| 243 |
+
}
|
| 244 |
+
|
| 245 |
+
.gradio-chatbot-message-bot {
|
| 246 |
+
background-color: #f1f1f1;
|
| 247 |
+
color: #333;
|
| 248 |
+
border-radius: 15px;
|
| 249 |
+
padding: 10px;
|
| 250 |
+
margin: 5px 0;
|
| 251 |
+
animation: fadeIn 0.5s ease-in-out;
|
| 252 |
+
}
|
| 253 |
+
|
| 254 |
+
/* Input Box */
|
| 255 |
+
#user-question {
|
| 256 |
+
background-color: #e9ecef;
|
| 257 |
+
border-radius: 8px;
|
| 258 |
+
padding: 10px;
|
| 259 |
+
box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
|
| 260 |
+
transition: background-color 0.3s ease;
|
| 261 |
+
}
|
| 262 |
+
|
| 263 |
+
#user-question:hover {
|
| 264 |
+
background-color: #f1f1f1;
|
| 265 |
+
}
|
| 266 |
+
|
| 267 |
+
/* Submit Button */
|
| 268 |
+
#submit-btn {
|
| 269 |
+
background-color: #007bff;
|
| 270 |
+
color: white;
|
| 271 |
+
border-radius: 8px;
|
| 272 |
+
transition: transform 0.2s ease-in-out;
|
| 273 |
+
}
|
| 274 |
+
|
| 275 |
+
#submit-btn:hover {
|
| 276 |
+
transform: scale(1.1);
|
| 277 |
+
}
|
| 278 |
+
|
| 279 |
+
/* Animation for message appearance */
|
| 280 |
+
@keyframes fadeIn {
|
| 281 |
+
0% { opacity: 0; transform: translateY(20px); }
|
| 282 |
+
100% { opacity: 1; transform: translateY(0); }
|
| 283 |
+
}
|
| 284 |
+
"""
|
| 285 |
+
|
| 286 |
demo.launch(server_name="0.0.0.0", server_port=7860, share=True)
|