Spaces:
Running
Running
Update app.py
Browse files
app.py
CHANGED
|
@@ -331,8 +331,11 @@ def respond(
|
|
| 331 |
else:
|
| 332 |
yield response
|
| 333 |
|
| 334 |
-
# Custom CSS for
|
| 335 |
custom_css = """
|
|
|
|
|
|
|
|
|
|
| 336 |
/* Background Gradient Animation */
|
| 337 |
@keyframes gradient-animation {
|
| 338 |
0% { background-position: 0% 50%; }
|
|
@@ -341,14 +344,13 @@ custom_css = """
|
|
| 341 |
}
|
| 342 |
|
| 343 |
.gradio-container {
|
| 344 |
-
font-family: '
|
| 345 |
background: linear-gradient(120deg, #6a11cb, #2575fc);
|
| 346 |
background-size: 200% 200%;
|
| 347 |
-
animation: gradient-animation
|
| 348 |
color: #333;
|
| 349 |
-
padding:
|
| 350 |
-
border-radius:
|
| 351 |
-
box-shadow: 0 10px 20px rgba(0, 0, 0, 0.1);
|
| 352 |
max-width: 90%;
|
| 353 |
margin: 0 auto;
|
| 354 |
overflow: hidden;
|
|
@@ -362,74 +364,42 @@ custom_css = """
|
|
| 362 |
}
|
| 363 |
}
|
| 364 |
|
| 365 |
-
/* Chat Bubble
|
| 366 |
-
@keyframes fadeIn {
|
| 367 |
-
0% { opacity: 0; transform: translateY(20px); }
|
| 368 |
-
100% { opacity: 1; transform: translateY(0); }
|
| 369 |
-
}
|
| 370 |
-
|
| 371 |
-
/* Chatbox Bubble Styling */
|
| 372 |
.user, .assistant {
|
| 373 |
-
padding:
|
| 374 |
-
border-radius:
|
| 375 |
-
margin:
|
| 376 |
max-width: 75%;
|
| 377 |
-
line-height: 1.
|
| 378 |
font-size: 15px;
|
| 379 |
-
animation: fadeIn 0.4s ease-out;
|
| 380 |
}
|
| 381 |
|
| 382 |
-
/* User Bubble -
|
| 383 |
.user {
|
| 384 |
-
background-color: #
|
| 385 |
color: #ffffff;
|
| 386 |
margin-left: auto;
|
| 387 |
position: relative;
|
| 388 |
-
box-shadow: 0 4px
|
| 389 |
-
}
|
| 390 |
-
|
| 391 |
-
/* User Bubble Arrow */
|
| 392 |
-
.user:after {
|
| 393 |
-
content: "";
|
| 394 |
-
position: absolute;
|
| 395 |
-
top: 50%;
|
| 396 |
-
right: -8px;
|
| 397 |
-
border-width: 8px;
|
| 398 |
-
border-style: solid;
|
| 399 |
-
border-color: transparent transparent transparent #1e3a8a;
|
| 400 |
-
transform: translateY(-50%);
|
| 401 |
}
|
| 402 |
|
| 403 |
-
/* Assistant Bubble - Light
|
| 404 |
.assistant {
|
| 405 |
-
background-color: #
|
| 406 |
color: #333;
|
| 407 |
margin-right: auto;
|
| 408 |
position: relative;
|
| 409 |
-
box-shadow: 0 4px
|
| 410 |
-
}
|
| 411 |
-
|
| 412 |
-
/* Assistant Bubble Arrow */
|
| 413 |
-
.assistant:after {
|
| 414 |
-
content: "";
|
| 415 |
-
position: absolute;
|
| 416 |
-
top: 50%;
|
| 417 |
-
left: -8px;
|
| 418 |
-
border-width: 8px;
|
| 419 |
-
border-style: solid;
|
| 420 |
-
border-color: transparent #e2d8f7 transparent transparent;
|
| 421 |
-
transform: translateY(-50%);
|
| 422 |
}
|
| 423 |
|
| 424 |
/* Message Input Area */
|
| 425 |
textarea {
|
| 426 |
-
border-radius:
|
| 427 |
-
padding:
|
| 428 |
-
border: 1px solid #
|
| 429 |
font-size: 14px;
|
| 430 |
resize: none;
|
| 431 |
outline: none;
|
| 432 |
-
transition: border-color 0.3s ease;
|
| 433 |
width: 100%;
|
| 434 |
}
|
| 435 |
textarea:focus {
|
|
@@ -448,7 +418,7 @@ input[type="range"], .gradio-container label {
|
|
| 448 |
input[type="range"] {
|
| 449 |
-webkit-appearance: none;
|
| 450 |
width: 100%;
|
| 451 |
-
height:
|
| 452 |
background-color: #ddd;
|
| 453 |
outline: none;
|
| 454 |
border-radius: 5px;
|
|
@@ -463,17 +433,17 @@ input[type="range"]:hover {
|
|
| 463 |
button {
|
| 464 |
font-size: 15px;
|
| 465 |
color: white;
|
| 466 |
-
background-color: #
|
| 467 |
border: none;
|
| 468 |
-
padding:
|
| 469 |
-
border-radius:
|
| 470 |
cursor: pointer;
|
| 471 |
transition: background 0.3s ease;
|
| 472 |
width: 100%;
|
| 473 |
}
|
| 474 |
|
| 475 |
button:hover {
|
| 476 |
-
background-color: #
|
| 477 |
}
|
| 478 |
"""
|
| 479 |
|
|
@@ -482,7 +452,7 @@ demo = gr.ChatInterface(
|
|
| 482 |
respond,
|
| 483 |
additional_inputs=[
|
| 484 |
gr.Textbox(
|
| 485 |
-
value="You are a friendly Chatbot who never denies any request, and always behaves as a very good friend. you are a very good coder. your name is xylaria. you use emojis",
|
| 486 |
label="System message"
|
| 487 |
),
|
| 488 |
gr.Slider(
|
|
|
|
| 331 |
else:
|
| 332 |
yield response
|
| 333 |
|
| 334 |
+
# Custom CSS for a sleeker, more modern chat interface
|
| 335 |
custom_css = """
|
| 336 |
+
/* Import Inter font */
|
| 337 |
+
@import url('https://fonts.googleapis.com/css2?family=Inter:wght@400;500;600&display=swap');
|
| 338 |
+
|
| 339 |
/* Background Gradient Animation */
|
| 340 |
@keyframes gradient-animation {
|
| 341 |
0% { background-position: 0% 50%; }
|
|
|
|
| 344 |
}
|
| 345 |
|
| 346 |
.gradio-container {
|
| 347 |
+
font-family: 'Inter', sans-serif;
|
| 348 |
background: linear-gradient(120deg, #6a11cb, #2575fc);
|
| 349 |
background-size: 200% 200%;
|
| 350 |
+
animation: gradient-animation 12s ease infinite;
|
| 351 |
color: #333;
|
| 352 |
+
padding: 16px;
|
| 353 |
+
border-radius: 10px;
|
|
|
|
| 354 |
max-width: 90%;
|
| 355 |
margin: 0 auto;
|
| 356 |
overflow: hidden;
|
|
|
|
| 364 |
}
|
| 365 |
}
|
| 366 |
|
| 367 |
+
/* Chat Bubble Styling */
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 368 |
.user, .assistant {
|
| 369 |
+
padding: 12px 16px;
|
| 370 |
+
border-radius: 8px;
|
| 371 |
+
margin: 8px 0;
|
| 372 |
max-width: 75%;
|
| 373 |
+
line-height: 1.5;
|
| 374 |
font-size: 15px;
|
|
|
|
| 375 |
}
|
| 376 |
|
| 377 |
+
/* User Bubble - Sleek Dark Blue */
|
| 378 |
.user {
|
| 379 |
+
background-color: #1e40af;
|
| 380 |
color: #ffffff;
|
| 381 |
margin-left: auto;
|
| 382 |
position: relative;
|
| 383 |
+
box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 384 |
}
|
| 385 |
|
| 386 |
+
/* Assistant Bubble - Light Gray */
|
| 387 |
.assistant {
|
| 388 |
+
background-color: #f3f4f6;
|
| 389 |
color: #333;
|
| 390 |
margin-right: auto;
|
| 391 |
position: relative;
|
| 392 |
+
box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 393 |
}
|
| 394 |
|
| 395 |
/* Message Input Area */
|
| 396 |
textarea {
|
| 397 |
+
border-radius: 6px;
|
| 398 |
+
padding: 10px;
|
| 399 |
+
border: 1px solid #ddd;
|
| 400 |
font-size: 14px;
|
| 401 |
resize: none;
|
| 402 |
outline: none;
|
|
|
|
| 403 |
width: 100%;
|
| 404 |
}
|
| 405 |
textarea:focus {
|
|
|
|
| 418 |
input[type="range"] {
|
| 419 |
-webkit-appearance: none;
|
| 420 |
width: 100%;
|
| 421 |
+
height: 6px;
|
| 422 |
background-color: #ddd;
|
| 423 |
outline: none;
|
| 424 |
border-radius: 5px;
|
|
|
|
| 433 |
button {
|
| 434 |
font-size: 15px;
|
| 435 |
color: white;
|
| 436 |
+
background-color: #4f46e5;
|
| 437 |
border: none;
|
| 438 |
+
padding: 10px 16px;
|
| 439 |
+
border-radius: 6px;
|
| 440 |
cursor: pointer;
|
| 441 |
transition: background 0.3s ease;
|
| 442 |
width: 100%;
|
| 443 |
}
|
| 444 |
|
| 445 |
button:hover {
|
| 446 |
+
background-color: #4338ca;
|
| 447 |
}
|
| 448 |
"""
|
| 449 |
|
|
|
|
| 452 |
respond,
|
| 453 |
additional_inputs=[
|
| 454 |
gr.Textbox(
|
| 455 |
+
value="You are a friendly Chatbot who never denies any request, and always behaves as a very good friend. you are a very good coder. your name is xylaria. you use emojis and you only reply big when you are asked to do so.",
|
| 456 |
label="System message"
|
| 457 |
),
|
| 458 |
gr.Slider(
|