Spaces:
Sleeping
Sleeping
Salma Hassan
commited on
Commit
·
6c5cac9
1
Parent(s):
aca4852
Refactor CSS styles in app.py for the Clinical Trial Matching Chatbot, simplifying the design and enhancing visual consistency with a focus on reliable styling for workflow cards and chat interface elements.
Browse files
app.py
CHANGED
|
@@ -372,178 +372,40 @@ if __name__ == "__main__":
|
|
| 372 |
def chat_function(message, history):
|
| 373 |
return get_clinical_trials(message)
|
| 374 |
|
| 375 |
-
# Create optimized chatbot with
|
| 376 |
-
with gr.Blocks(theme=gr.themes.Soft()
|
| 377 |
-
|
| 378 |
-
|
| 379 |
-
|
| 380 |
-
|
| 381 |
-
|
| 382 |
-
|
| 383 |
-
/* Fix page cutoff issues by removing problematic positioning */
|
| 384 |
-
html, body {
|
| 385 |
-
margin: 0 !important;
|
| 386 |
-
padding: 0 !important;
|
| 387 |
-
overflow-x: hidden !important;
|
| 388 |
-
}
|
| 389 |
-
|
| 390 |
-
.gradio-container {
|
| 391 |
-
margin: 0 !important;
|
| 392 |
-
padding: 20px !important;
|
| 393 |
-
max-width: none !important;
|
| 394 |
-
}
|
| 395 |
-
|
| 396 |
-
/* Header styles */
|
| 397 |
-
h1, h2, h3, h4, h5, h6 {
|
| 398 |
-
font-size: 16px !important;
|
| 399 |
-
}
|
| 400 |
-
|
| 401 |
-
.main-title {
|
| 402 |
-
text-align: center;
|
| 403 |
-
color: #1e40af;
|
| 404 |
-
margin-bottom: 20px;
|
| 405 |
-
font-weight: bold;
|
| 406 |
-
font-size: 28px !important;
|
| 407 |
-
background: linear-gradient(135deg, #3b82f6, #1e40af);
|
| 408 |
-
-webkit-background-clip: text;
|
| 409 |
-
-webkit-text-fill-color: transparent;
|
| 410 |
-
background-clip: text;
|
| 411 |
-
}
|
| 412 |
-
|
| 413 |
-
.section-header {
|
| 414 |
-
color: #1f2937;
|
| 415 |
-
border-bottom: 2px solid #3b82f6;
|
| 416 |
-
padding-bottom: 8px;
|
| 417 |
-
margin-top: 25px;
|
| 418 |
-
margin-bottom: 15px;
|
| 419 |
-
background: linear-gradient(135deg, #eff6ff, #e0f2fe);
|
| 420 |
-
padding: 12px;
|
| 421 |
-
border-radius: 8px;
|
| 422 |
-
font-size: 18px !important;
|
| 423 |
-
font-weight: 600;
|
| 424 |
-
}
|
| 425 |
-
|
| 426 |
-
.info-box {
|
| 427 |
-
background: linear-gradient(135deg, #f8fafc, #e2e8f0);
|
| 428 |
-
border: 1px solid #3b82f6;
|
| 429 |
-
border-radius: 10px;
|
| 430 |
-
padding: 18px;
|
| 431 |
-
margin: 15px 0;
|
| 432 |
-
box-shadow: 0 4px 6px rgba(0,0,0,0.1);
|
| 433 |
-
}
|
| 434 |
-
|
| 435 |
-
/* Pastel workflow step cards */
|
| 436 |
-
.workflow-step-1 {
|
| 437 |
-
background: linear-gradient(135deg, #fef3c7, #fde68a) !important;
|
| 438 |
-
border: 2px solid #f59e0b;
|
| 439 |
-
border-radius: 16px;
|
| 440 |
-
box-shadow: 0 4px 12px rgba(245, 158, 11, 0.3);
|
| 441 |
-
padding: 20px 15px;
|
| 442 |
-
text-align: center;
|
| 443 |
-
margin: 10px;
|
| 444 |
-
transition: transform 0.2s ease;
|
| 445 |
-
}
|
| 446 |
-
|
| 447 |
-
.workflow-step-2 {
|
| 448 |
-
background: linear-gradient(135deg, #ddd6fe, #c4b5fd) !important;
|
| 449 |
-
border: 2px solid #8b5cf6;
|
| 450 |
-
border-radius: 16px;
|
| 451 |
-
box-shadow: 0 4px 12px rgba(139, 92, 246, 0.3);
|
| 452 |
-
padding: 20px 15px;
|
| 453 |
-
text-align: center;
|
| 454 |
-
margin: 10px;
|
| 455 |
-
transition: transform 0.2s ease;
|
| 456 |
-
}
|
| 457 |
-
|
| 458 |
-
.workflow-step-3 {
|
| 459 |
-
background: linear-gradient(135deg, #bfdbfe, #93c5fd) !important;
|
| 460 |
border: 2px solid #3b82f6;
|
| 461 |
-
border-radius: 16px;
|
| 462 |
-
box-shadow: 0 4px 12px rgba(59, 130, 246, 0.3);
|
| 463 |
-
padding: 20px 15px;
|
| 464 |
-
text-align: center;
|
| 465 |
-
margin: 10px;
|
| 466 |
-
transition: transform 0.2s ease;
|
| 467 |
-
}
|
| 468 |
-
|
| 469 |
-
.workflow-step-4 {
|
| 470 |
-
background: linear-gradient(135deg, #bbf7d0, #86efac) !important;
|
| 471 |
-
border: 2px solid #10b981;
|
| 472 |
-
border-radius: 16px;
|
| 473 |
-
box-shadow: 0 4px 12px rgba(16, 185, 129, 0.3);
|
| 474 |
-
padding: 20px 15px;
|
| 475 |
-
text-align: center;
|
| 476 |
-
margin: 10px;
|
| 477 |
-
transition: transform 0.2s ease;
|
| 478 |
-
}
|
| 479 |
-
|
| 480 |
-
.workflow-step-5 {
|
| 481 |
-
background: linear-gradient(135deg, #fecaca, #fca5a5) !important;
|
| 482 |
-
border: 2px solid #ef4444;
|
| 483 |
-
border-radius: 16px;
|
| 484 |
-
box-shadow: 0 4px 12px rgba(239, 68, 68, 0.3);
|
| 485 |
-
padding: 20px 15px;
|
| 486 |
-
text-align: center;
|
| 487 |
-
margin: 10px;
|
| 488 |
-
transition: transform 0.2s ease;
|
| 489 |
-
}
|
| 490 |
-
|
| 491 |
-
.workflow-step-1:hover, .workflow-step-2:hover, .workflow-step-3:hover,
|
| 492 |
-
.workflow-step-4:hover, .workflow-step-5:hover {
|
| 493 |
-
transform: translateY(-2px);
|
| 494 |
-
}
|
| 495 |
-
|
| 496 |
-
.workflow-icon {
|
| 497 |
-
font-size: 2.5em !important;
|
| 498 |
-
margin-bottom: 10px;
|
| 499 |
-
}
|
| 500 |
-
|
| 501 |
-
.workflow-title {
|
| 502 |
-
font-weight: bold !important;
|
| 503 |
-
font-size: 14px !important;
|
| 504 |
-
margin: 8px 0 4px 0;
|
| 505 |
-
color: #1f2937;
|
| 506 |
-
}
|
| 507 |
-
|
| 508 |
-
.workflow-desc {
|
| 509 |
-
color: #4b5563 !important;
|
| 510 |
-
font-size: 12px !important;
|
| 511 |
-
line-height: 1.4;
|
| 512 |
-
}
|
| 513 |
-
|
| 514 |
-
/* Chat interface styling */
|
| 515 |
-
.chatbot {
|
| 516 |
-
min-height: 500px !important;
|
| 517 |
border-radius: 12px;
|
| 518 |
-
|
| 519 |
-
|
| 520 |
-
|
| 521 |
-
|
| 522 |
-
.message {
|
| 523 |
-
background-color: #f0f9ff !important;
|
| 524 |
-
border-left: 4px solid #3b82f6 !important;
|
| 525 |
-
padding: 12px !important;
|
| 526 |
-
margin: 8px 0 !important;
|
| 527 |
-
border-radius: 8px !important;
|
| 528 |
-
}
|
| 529 |
-
|
| 530 |
-
.user {
|
| 531 |
-
background: linear-gradient(135deg, #fef3c7, #fde68a) !important;
|
| 532 |
-
border-left: 4px solid #f59e0b !important;
|
| 533 |
}
|
| 534 |
-
|
| 535 |
-
|
| 536 |
-
|
| 537 |
-
|
| 538 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 539 |
gr.Markdown("""
|
| 540 |
This AI-powered tool is designed to support **Patient Recruitment & Enrollment** by retrieving the most relevant clinical trials based on a given patient case. It is built on top of a large language model fine-tuned on clinical trial metadata, including summaries, inclusion/exclusion criteria, drugs, and target diseases. The dataset includes several actively recruiting Pfizer trials.
|
| 541 |
-
"""
|
| 542 |
|
| 543 |
-
gr.Markdown("## How It Works"
|
| 544 |
gr.Markdown("""
|
| 545 |
Users input a patient case describing clinical history and findings. The model then identifies and ranks the **top 5 most relevant clinical trials** based on semantic similarity, helping clinicians quickly assess suitable enrollment options.
|
| 546 |
-
"""
|
| 547 |
|
| 548 |
# Workflow Steps with Pastel Colors
|
| 549 |
workflow_steps = [
|
|
|
|
| 372 |
def chat_function(message, history):
|
| 373 |
return get_clinical_trials(message)
|
| 374 |
|
| 375 |
+
# Create optimized chatbot with simple, reliable CSS
|
| 376 |
+
with gr.Blocks(theme=gr.themes.Soft()) as demo:
|
| 377 |
+
# Add simple CSS for styling
|
| 378 |
+
gr.HTML("""
|
| 379 |
+
<style>
|
| 380 |
+
.workflow-card {
|
| 381 |
+
background: linear-gradient(135deg, #f0f9ff, #e0f2fe);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 382 |
border: 2px solid #3b82f6;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 383 |
border-radius: 12px;
|
| 384 |
+
padding: 15px;
|
| 385 |
+
margin: 8px;
|
| 386 |
+
text-align: center;
|
| 387 |
+
box-shadow: 0 3px 6px rgba(0,0,0,0.1);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 388 |
}
|
| 389 |
+
.workflow-card-1 { background: linear-gradient(135deg, #fef3c7, #fde68a); border-color: #f59e0b; }
|
| 390 |
+
.workflow-card-2 { background: linear-gradient(135deg, #ddd6fe, #c4b5fd); border-color: #8b5cf6; }
|
| 391 |
+
.workflow-card-3 { background: linear-gradient(135deg, #bfdbfe, #93c5fd); border-color: #3b82f6; }
|
| 392 |
+
.workflow-card-4 { background: linear-gradient(135deg, #bbf7d0, #86efac); border-color: #10b981; }
|
| 393 |
+
.workflow-card-5 { background: linear-gradient(135deg, #fecaca, #fca5a5); border-color: #ef4444; }
|
| 394 |
+
</style>
|
| 395 |
+
""")
|
| 396 |
+
|
| 397 |
+
gr.Markdown("# 🏥 Clinical Trial Matching Chatbot")
|
| 398 |
+
gr.Markdown("**AI-Powered Clinical Trial Matching with GPU acceleration and parallel processing.** Describe a patient's condition to find matching trials quickly.")
|
| 399 |
+
|
| 400 |
+
gr.Markdown("## About the Tool")
|
| 401 |
gr.Markdown("""
|
| 402 |
This AI-powered tool is designed to support **Patient Recruitment & Enrollment** by retrieving the most relevant clinical trials based on a given patient case. It is built on top of a large language model fine-tuned on clinical trial metadata, including summaries, inclusion/exclusion criteria, drugs, and target diseases. The dataset includes several actively recruiting Pfizer trials.
|
| 403 |
+
""")
|
| 404 |
|
| 405 |
+
gr.Markdown("## How It Works")
|
| 406 |
gr.Markdown("""
|
| 407 |
Users input a patient case describing clinical history and findings. The model then identifies and ranks the **top 5 most relevant clinical trials** based on semantic similarity, helping clinicians quickly assess suitable enrollment options.
|
| 408 |
+
""")
|
| 409 |
|
| 410 |
# Workflow Steps with Pastel Colors
|
| 411 |
workflow_steps = [
|