Spaces:
Running
Running
Update app.py
Browse files
app.py
CHANGED
|
@@ -225,22 +225,41 @@ class XylariaChat:
|
|
| 225 |
|
| 226 |
# Custom CSS for Inter font and improved styling
|
| 227 |
custom_css = """
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 228 |
@import url('https://fonts.googleapis.com/css2?family=Inter:wght@300;400;500;600;700&display=swap');
|
| 229 |
-
|
| 230 |
body, .gradio-container {
|
| 231 |
font-family: 'Inter', sans-serif !important;
|
| 232 |
}
|
| 233 |
-
|
| 234 |
.chatbot-container .message {
|
| 235 |
font-family: 'Inter', sans-serif !important;
|
|
|
|
| 236 |
}
|
| 237 |
-
|
| 238 |
.gradio-container input,
|
| 239 |
.gradio-container textarea,
|
| 240 |
.gradio-container button {
|
| 241 |
font-family: 'Inter', sans-serif !important;
|
|
|
|
| 242 |
}
|
| 243 |
-
|
| 244 |
/* Image Upload Styling */
|
| 245 |
.image-container {
|
| 246 |
border: 1px solid #ccc;
|
|
@@ -251,20 +270,17 @@ class XylariaChat:
|
|
| 251 |
flex-direction: column;
|
| 252 |
align-items: center;
|
| 253 |
gap: 10px;
|
| 254 |
-
background-color: #
|
| 255 |
}
|
| 256 |
-
|
| 257 |
.image-preview {
|
| 258 |
max-width: 200px;
|
| 259 |
max-height: 200px;
|
| 260 |
border-radius: 8px;
|
| 261 |
}
|
| 262 |
-
|
| 263 |
.image-buttons {
|
| 264 |
display: flex;
|
| 265 |
gap: 10px;
|
| 266 |
}
|
| 267 |
-
|
| 268 |
.image-buttons button {
|
| 269 |
padding: 8px 15px;
|
| 270 |
border-radius: 5px;
|
|
@@ -273,19 +289,125 @@ class XylariaChat:
|
|
| 273 |
border: none;
|
| 274 |
cursor: pointer;
|
| 275 |
}
|
| 276 |
-
|
| 277 |
.image-buttons button:hover {
|
| 278 |
background-color: #367c39;
|
| 279 |
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 280 |
"""
|
| 281 |
|
| 282 |
-
with gr.Blocks(theme='soft', css=custom_css) as demo:
|
| 283 |
# Chat interface with improved styling
|
| 284 |
with gr.Column():
|
| 285 |
chatbot = gr.Chatbot(
|
| 286 |
label="Xylaria 1.5 Senoa (EXPERIMENTAL)",
|
| 287 |
height=500,
|
| 288 |
show_copy_button=True,
|
|
|
|
|
|
|
| 289 |
)
|
| 290 |
|
| 291 |
# Enhanced Image Upload Section
|
|
@@ -302,17 +424,18 @@ class XylariaChat:
|
|
| 302 |
|
| 303 |
# Input row with improved layout
|
| 304 |
with gr.Row():
|
| 305 |
-
with gr.Column(scale=
|
| 306 |
txt = gr.Textbox(
|
| 307 |
show_label=False,
|
| 308 |
-
placeholder="
|
| 309 |
container=False
|
| 310 |
)
|
| 311 |
-
|
|
|
|
| 312 |
|
| 313 |
# Clear history and memory buttons
|
| 314 |
with gr.Row():
|
| 315 |
-
clear = gr.Button("Clear Conversation")
|
| 316 |
clear_memory = gr.Button("Clear Memory")
|
| 317 |
|
| 318 |
# Clear image functionality
|
|
|
|
| 225 |
|
| 226 |
# Custom CSS for Inter font and improved styling
|
| 227 |
custom_css = """
|
| 228 |
+
body {
|
| 229 |
+
background-color: #202123;
|
| 230 |
+
color: #ececf1;
|
| 231 |
+
}
|
| 232 |
+
.dark #banner-wrap {
|
| 233 |
+
background-color: #202123;
|
| 234 |
+
}
|
| 235 |
+
.dark #banner {
|
| 236 |
+
background-color: #202123;
|
| 237 |
+
color: #ececf1;
|
| 238 |
+
}
|
| 239 |
+
.dark .form-wrap {
|
| 240 |
+
background: none;
|
| 241 |
+
background-color: #343541;
|
| 242 |
+
border-color: #343541;
|
| 243 |
+
}
|
| 244 |
+
.dark .secondary-wrap {
|
| 245 |
+
background: none;
|
| 246 |
+
background-color: #202123;
|
| 247 |
+
border-color: #202123;
|
| 248 |
+
}
|
| 249 |
@import url('https://fonts.googleapis.com/css2?family=Inter:wght@300;400;500;600;700&display=swap');
|
|
|
|
| 250 |
body, .gradio-container {
|
| 251 |
font-family: 'Inter', sans-serif !important;
|
| 252 |
}
|
|
|
|
| 253 |
.chatbot-container .message {
|
| 254 |
font-family: 'Inter', sans-serif !important;
|
| 255 |
+
color: #ececf1;
|
| 256 |
}
|
|
|
|
| 257 |
.gradio-container input,
|
| 258 |
.gradio-container textarea,
|
| 259 |
.gradio-container button {
|
| 260 |
font-family: 'Inter', sans-serif !important;
|
| 261 |
+
color: #ececf1;
|
| 262 |
}
|
|
|
|
| 263 |
/* Image Upload Styling */
|
| 264 |
.image-container {
|
| 265 |
border: 1px solid #ccc;
|
|
|
|
| 270 |
flex-direction: column;
|
| 271 |
align-items: center;
|
| 272 |
gap: 10px;
|
| 273 |
+
background-color: #343541;
|
| 274 |
}
|
|
|
|
| 275 |
.image-preview {
|
| 276 |
max-width: 200px;
|
| 277 |
max-height: 200px;
|
| 278 |
border-radius: 8px;
|
| 279 |
}
|
|
|
|
| 280 |
.image-buttons {
|
| 281 |
display: flex;
|
| 282 |
gap: 10px;
|
| 283 |
}
|
|
|
|
| 284 |
.image-buttons button {
|
| 285 |
padding: 8px 15px;
|
| 286 |
border-radius: 5px;
|
|
|
|
| 289 |
border: none;
|
| 290 |
cursor: pointer;
|
| 291 |
}
|
|
|
|
| 292 |
.image-buttons button:hover {
|
| 293 |
background-color: #367c39;
|
| 294 |
}
|
| 295 |
+
.dark .gr-button-primary {
|
| 296 |
+
background-color: #585862;
|
| 297 |
+
color: #ececf1;
|
| 298 |
+
}
|
| 299 |
+
.dark .gr-button-secondary {
|
| 300 |
+
background-color: #444654;
|
| 301 |
+
color: #ececf1;
|
| 302 |
+
}
|
| 303 |
+
.dark .gr-button-secondary:hover {
|
| 304 |
+
background-color: #343541;
|
| 305 |
+
color: #ececf1;
|
| 306 |
+
}
|
| 307 |
+
.dark .gr-button-primary:hover {
|
| 308 |
+
background-color: #343541;
|
| 309 |
+
color: #ececf1;
|
| 310 |
+
}
|
| 311 |
+
.dark .gr-textbox {
|
| 312 |
+
background-color: #444654;
|
| 313 |
+
color: #ececf1;
|
| 314 |
+
}
|
| 315 |
+
.dark .gr-textbox::placeholder {
|
| 316 |
+
color: #888888;
|
| 317 |
+
}
|
| 318 |
+
.dark .gr-chatbot {
|
| 319 |
+
background-color: #343541;
|
| 320 |
+
color: #ececf1;
|
| 321 |
+
}
|
| 322 |
+
.dark .gr-chatbot .message {
|
| 323 |
+
background-color: #343541;
|
| 324 |
+
color: #ececf1;
|
| 325 |
+
}
|
| 326 |
+
.dark .gr-chatbot .user {
|
| 327 |
+
background-color: #343541;
|
| 328 |
+
color: #ececf1;
|
| 329 |
+
}
|
| 330 |
+
.dark .gr-chatbot .assistant {
|
| 331 |
+
background-color: #343541;
|
| 332 |
+
color: #ececf1;
|
| 333 |
+
}
|
| 334 |
+
.dark .gr-chatbot .user-response {
|
| 335 |
+
background-color: #343541;
|
| 336 |
+
color: #ececf1;
|
| 337 |
+
}
|
| 338 |
+
.dark .gr-chatbot .assistant-response {
|
| 339 |
+
background-color: #343541;
|
| 340 |
+
color: #ececf1;
|
| 341 |
+
}
|
| 342 |
+
.dark .gr-chatbot .user-response .gr-textbox {
|
| 343 |
+
background-color: #343541;
|
| 344 |
+
color: #ececf1;
|
| 345 |
+
}
|
| 346 |
+
.dark .gr-chatbot .assistant-response .gr-textbox {
|
| 347 |
+
background-color: #343541;
|
| 348 |
+
color: #ececf1;
|
| 349 |
+
}
|
| 350 |
+
.dark .gr-chatbot .user-response .gr-textbox::placeholder {
|
| 351 |
+
color: #888888;
|
| 352 |
+
}
|
| 353 |
+
.dark .gr-chatbot .assistant-response .gr-textbox::placeholder {
|
| 354 |
+
color: #888888;
|
| 355 |
+
}
|
| 356 |
+
.dark .gr-chatbot .user-response .gr-textbox:focus {
|
| 357 |
+
border-color: #888888;
|
| 358 |
+
}
|
| 359 |
+
.dark .gr-chatbot .assistant-response .gr-textbox:focus {
|
| 360 |
+
border-color: #888888;
|
| 361 |
+
}
|
| 362 |
+
.dark .gr-chatbot .user-response .gr-textbox:hover {
|
| 363 |
+
border-color: #888888;
|
| 364 |
+
}
|
| 365 |
+
.dark .gr-chatbot .assistant-response .gr-textbox:hover {
|
| 366 |
+
border-color: #888888;
|
| 367 |
+
}
|
| 368 |
+
.dark .gr-chatbot .user-response .gr-textbox:active {
|
| 369 |
+
border-color: #888888;
|
| 370 |
+
}
|
| 371 |
+
.dark .gr-chatbot .assistant-response .gr-textbox:active {
|
| 372 |
+
border-color: #888888;
|
| 373 |
+
}
|
| 374 |
+
.dark .gr-chatbot .user-response .gr-textbox:disabled {
|
| 375 |
+
background-color: #343541;
|
| 376 |
+
color: #888888;
|
| 377 |
+
}
|
| 378 |
+
.dark .gr-chatbot .assistant-response .gr-textbox:disabled {
|
| 379 |
+
background-color: #343541;
|
| 380 |
+
color: #888888;
|
| 381 |
+
}
|
| 382 |
+
.dark .gr-chatbot .user-response .gr-textbox:disabled::placeholder {
|
| 383 |
+
color: #888888;
|
| 384 |
+
}
|
| 385 |
+
.dark .gr-chatbot .assistant-response .gr-textbox:disabled::placeholder {
|
| 386 |
+
color: #888888;
|
| 387 |
+
}
|
| 388 |
+
.dark .gr-chatbot .user-response .gr-textbox:disabled:hover {
|
| 389 |
+
border-color: #888888;
|
| 390 |
+
}
|
| 391 |
+
.dark .gr-chatbot .assistant-response .gr-textbox:disabled:hover {
|
| 392 |
+
border-color: #888888;
|
| 393 |
+
}
|
| 394 |
+
.dark .gr-chatbot .user-response .gr-textbox:disabled:active {
|
| 395 |
+
border-color: #888888;
|
| 396 |
+
}
|
| 397 |
+
.dark .gr-chatbot .assistant-response .gr-textbox:disabled:active {
|
| 398 |
+
border-color: #888888;
|
| 399 |
+
}
|
| 400 |
"""
|
| 401 |
|
| 402 |
+
with gr.Blocks(theme='soft', css=custom_css, title="Xylaria") as demo:
|
| 403 |
# Chat interface with improved styling
|
| 404 |
with gr.Column():
|
| 405 |
chatbot = gr.Chatbot(
|
| 406 |
label="Xylaria 1.5 Senoa (EXPERIMENTAL)",
|
| 407 |
height=500,
|
| 408 |
show_copy_button=True,
|
| 409 |
+
bubble_full_width=False,
|
| 410 |
+
render=False
|
| 411 |
)
|
| 412 |
|
| 413 |
# Enhanced Image Upload Section
|
|
|
|
| 424 |
|
| 425 |
# Input row with improved layout
|
| 426 |
with gr.Row():
|
| 427 |
+
with gr.Column(scale=85):
|
| 428 |
txt = gr.Textbox(
|
| 429 |
show_label=False,
|
| 430 |
+
placeholder="What can I help with?",
|
| 431 |
container=False
|
| 432 |
)
|
| 433 |
+
with gr.Column(scale=15):
|
| 434 |
+
btn = gr.Button("Send", variant="primary")
|
| 435 |
|
| 436 |
# Clear history and memory buttons
|
| 437 |
with gr.Row():
|
| 438 |
+
clear = gr.Button("Clear Conversation", variant="stop")
|
| 439 |
clear_memory = gr.Button("Clear Memory")
|
| 440 |
|
| 441 |
# Clear image functionality
|