Spaces:
Running
Running
Update app.py
Browse files
app.py
CHANGED
|
@@ -225,40 +225,17 @@ class XylariaChat:
|
|
| 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 {
|
|
@@ -270,7 +247,7 @@ class XylariaChat:
|
|
| 270 |
flex-direction: column;
|
| 271 |
align-items: center;
|
| 272 |
gap: 10px;
|
| 273 |
-
background-color: #
|
| 274 |
}
|
| 275 |
.image-preview {
|
| 276 |
max-width: 200px;
|
|
@@ -292,122 +269,15 @@ class XylariaChat:
|
|
| 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
|
| 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,18 +294,17 @@ class XylariaChat:
|
|
| 424 |
|
| 425 |
# Input row with improved layout
|
| 426 |
with gr.Row():
|
| 427 |
-
with gr.Column(scale=
|
| 428 |
txt = gr.Textbox(
|
| 429 |
show_label=False,
|
| 430 |
-
placeholder="
|
| 431 |
container=False
|
| 432 |
)
|
| 433 |
-
|
| 434 |
-
btn = gr.Button("Send", variant="primary")
|
| 435 |
|
| 436 |
# Clear history and memory buttons
|
| 437 |
with gr.Row():
|
| 438 |
-
clear = gr.Button("Clear Conversation"
|
| 439 |
clear_memory = gr.Button("Clear Memory")
|
| 440 |
|
| 441 |
# Clear image functionality
|
|
|
|
| 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 |
body, .gradio-container {
|
| 230 |
font-family: 'Inter', sans-serif !important;
|
| 231 |
}
|
| 232 |
.chatbot-container .message {
|
| 233 |
font-family: 'Inter', sans-serif !important;
|
|
|
|
| 234 |
}
|
| 235 |
.gradio-container input,
|
| 236 |
.gradio-container textarea,
|
| 237 |
.gradio-container button {
|
| 238 |
font-family: 'Inter', sans-serif !important;
|
|
|
|
| 239 |
}
|
| 240 |
/* Image Upload Styling */
|
| 241 |
.image-container {
|
|
|
|
| 247 |
flex-direction: column;
|
| 248 |
align-items: center;
|
| 249 |
gap: 10px;
|
| 250 |
+
background-color: #f8f8f8;
|
| 251 |
}
|
| 252 |
.image-preview {
|
| 253 |
max-width: 200px;
|
|
|
|
| 269 |
.image-buttons button:hover {
|
| 270 |
background-color: #367c39;
|
| 271 |
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 272 |
"""
|
| 273 |
|
| 274 |
+
with gr.Blocks(theme='soft', css=custom_css) as demo:
|
| 275 |
# Chat interface with improved styling
|
| 276 |
with gr.Column():
|
| 277 |
chatbot = gr.Chatbot(
|
| 278 |
label="Xylaria 1.5 Senoa (EXPERIMENTAL)",
|
| 279 |
height=500,
|
| 280 |
show_copy_button=True,
|
|
|
|
|
|
|
| 281 |
)
|
| 282 |
|
| 283 |
# Enhanced Image Upload Section
|
|
|
|
| 294 |
|
| 295 |
# Input row with improved layout
|
| 296 |
with gr.Row():
|
| 297 |
+
with gr.Column(scale=4):
|
| 298 |
txt = gr.Textbox(
|
| 299 |
show_label=False,
|
| 300 |
+
placeholder="Type your message...",
|
| 301 |
container=False
|
| 302 |
)
|
| 303 |
+
btn = gr.Button("Send", scale=1)
|
|
|
|
| 304 |
|
| 305 |
# Clear history and memory buttons
|
| 306 |
with gr.Row():
|
| 307 |
+
clear = gr.Button("Clear Conversation")
|
| 308 |
clear_memory = gr.Button("Clear Memory")
|
| 309 |
|
| 310 |
# Clear image functionality
|