Salma Hassan commited on
Commit
a7bc3a7
Β·
1 Parent(s): 874d6f1

Enhance app.py for the Clinical Trial Matching Chatbot by updating CSS styles for improved text visibility and consistency across workflow steps. Adjust content structure to clarify the chatbot's functionality and enhance user experience.

Browse files
Files changed (1) hide show
  1. app.py +37 -26
app.py CHANGED
@@ -374,7 +374,7 @@ if __name__ == "__main__":
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 {
@@ -385,17 +385,22 @@ if __name__ == "__main__":
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("""
@@ -413,49 +418,55 @@ if __name__ == "__main__":
413
  with gr.Row():
414
  with gr.Column():
415
  gr.Markdown("""
416
- <div style="background: linear-gradient(135deg, #fef3c7, #fde68a); border: 2px solid #f59e0b; border-radius: 12px; padding: 15px; text-align: center; margin: 5px;">
417
- <div style="font-size: 2em;">πŸ“</div>
418
- <strong>1. Enter Patient Summary</strong><br>
419
- <small>Describe the patient's history and findings.</small>
420
  </div>
421
  """)
422
  with gr.Column():
423
  gr.Markdown("""
424
- <div style="background: linear-gradient(135deg, #ddd6fe, #c4b5fd); border: 2px solid #8b5cf6; border-radius: 12px; padding: 15px; text-align: center; margin: 5px;">
425
- <div style="font-size: 2em;">πŸ”‘</div>
426
- <strong>2. Keyword Extraction</strong><br>
427
- <small>AI extracts key medical conditions using GPT-4-turbo.</small>
428
  </div>
429
  """)
430
  with gr.Column():
431
  gr.Markdown("""
432
- <div style="background: linear-gradient(135deg, #bfdbfe, #93c5fd); border: 2px solid #3b82f6; border-radius: 12px; padding: 15px; text-align: center; margin: 5px;">
433
- <div style="font-size: 2em;">πŸ”Ž</div>
434
- <strong>3. Trial Retrieval</strong><br>
435
- <small>Keywords are matched to all trials (including Pfizer).</small>
436
  </div>
437
  """)
438
 
439
- # Row 2: Steps 4-5
440
  with gr.Row():
441
  with gr.Column():
442
  gr.Markdown("""
443
- <div style="background: linear-gradient(135deg, #bbf7d0, #86efac); border: 2px solid #10b981; border-radius: 12px; padding: 15px; text-align: center; margin: 5px;">
444
- <div style="font-size: 2em;">βœ…</div>
445
- <strong>4. Eligibility Check</strong><br>
446
- <small>Inclusion/exclusion criteria are checked for each trial.</small>
447
  </div>
448
  """)
449
  with gr.Column():
450
  gr.Markdown("""
451
- <div style="background: linear-gradient(135deg, #fecaca, #fca5a5); border: 2px solid #ef4444; border-radius: 12px; padding: 15px; text-align: center; margin: 5px;">
452
- <div style="font-size: 2em;">πŸ†</div>
453
- <strong>5. Ranking & Results</strong><br>
454
- <small>Top 5 matching trials are ranked and displayed. Pfizer trials are highlighted if present.</small>
455
  </div>
456
  """)
457
  with gr.Column():
458
- gr.Markdown("") # Empty column for better spacing
 
 
 
 
 
 
459
 
460
  gr.Markdown("## Start Matching")
461
  chatbot = gr.ChatInterface(
 
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 with black text
378
  gr.HTML("""
379
  <style>
380
  .workflow-card {
 
385
  margin: 8px;
386
  text-align: center;
387
  box-shadow: 0 3px 6px rgba(0,0,0,0.1);
388
+ color: #000000 !important;
389
+ }
390
+ .workflow-card * {
391
+ color: #000000 !important;
392
  }
393
  .workflow-card-1 { background: linear-gradient(135deg, #fef3c7, #fde68a); border-color: #f59e0b; }
394
  .workflow-card-2 { background: linear-gradient(135deg, #ddd6fe, #c4b5fd); border-color: #8b5cf6; }
395
  .workflow-card-3 { background: linear-gradient(135deg, #bfdbfe, #93c5fd); border-color: #3b82f6; }
396
+ .workflow-card-4 { background: linear-gradient(135deg, #dcfce7, #bbf7d0); border-color: #22c55e; }
397
+ .workflow-card-5 { background: linear-gradient(135deg, #bbf7d0, #86efac); border-color: #10b981; }
398
+ .workflow-card-6 { background: linear-gradient(135deg, #fecaca, #fca5a5); border-color: #ef4444; }
399
  </style>
400
  """)
401
 
402
  gr.Markdown("# πŸ₯ Clinical Trial Matching Chatbot")
403
+ gr.Markdown("**AI-Powered Clinical Trial Matching.** Describe a patient's condition to find matching trials quickly.")
404
 
405
  gr.Markdown("## About the Tool")
406
  gr.Markdown("""
 
418
  with gr.Row():
419
  with gr.Column():
420
  gr.Markdown("""
421
+ <div style="background: linear-gradient(135deg, #fef3c7, #fde68a); border: 2px solid #f59e0b; border-radius: 12px; padding: 15px; text-align: center; margin: 5px; color: #000000 !important;">
422
+ <div style="font-size: 2em; color: #000000 !important;">πŸ“</div>
423
+ <strong style="color: #000000 !important;">1. Enter Patient Summary</strong><br>
424
+ <small style="color: #000000 !important;">Describe the patient's history and findings.</small>
425
  </div>
426
  """)
427
  with gr.Column():
428
  gr.Markdown("""
429
+ <div style="background: linear-gradient(135deg, #ddd6fe, #c4b5fd); border: 2px solid #8b5cf6; border-radius: 12px; padding: 15px; text-align: center; margin: 5px; color: #000000 !important;">
430
+ <div style="font-size: 2em; color: #000000 !important;">πŸ”‘</div>
431
+ <strong style="color: #000000 !important;">2. Keyword Extraction</strong><br>
432
+ <small style="color: #000000 !important;">AI extracts key medical conditions using GPT-4.</small>
433
  </div>
434
  """)
435
  with gr.Column():
436
  gr.Markdown("""
437
+ <div style="background: linear-gradient(135deg, #bfdbfe, #93c5fd); border: 2px solid #3b82f6; border-radius: 12px; padding: 15px; text-align: center; margin: 5px; color: #000000 !important;">
438
+ <div style="font-size: 2em; color: #000000 !important;">πŸ”Ž</div>
439
+ <strong style="color: #000000 !important;">3. Trial Retrieval</strong><br>
440
+ <small style="color: #000000 !important;">Keywords are matched to all trials (including Pfizer).</small>
441
  </div>
442
  """)
443
 
444
+ # Row 2: Steps 4-6
445
  with gr.Row():
446
  with gr.Column():
447
  gr.Markdown("""
448
+ <div style="background: linear-gradient(135deg, #dcfce7, #bbf7d0); border: 2px solid #22c55e; border-radius: 12px; padding: 15px; text-align: center; margin: 5px; color: #000000 !important;">
449
+ <div style="font-size: 2em; color: #000000 !important;">βš™οΈ</div>
450
+ <strong style="color: #000000 !important;">4. Data Processing</strong><br>
451
+ <small style="color: #000000 !important;">Patient data is tokenized and preprocessed for analysis.</small>
452
  </div>
453
  """)
454
  with gr.Column():
455
  gr.Markdown("""
456
+ <div style="background: linear-gradient(135deg, #bbf7d0, #86efac); border: 2px solid #10b981; border-radius: 12px; padding: 15px; text-align: center; margin: 5px; color: #000000 !important;">
457
+ <div style="font-size: 2em; color: #000000 !important;">βœ…</div>
458
+ <strong style="color: #000000 !important;">5. Eligibility Check</strong><br>
459
+ <small style="color: #000000 !important;">Inclusion/exclusion criteria are checked in parallel.</small>
460
  </div>
461
  """)
462
  with gr.Column():
463
+ gr.Markdown("""
464
+ <div style="background: linear-gradient(135deg, #fecaca, #fca5a5); border: 2px solid #ef4444; border-radius: 12px; padding: 15px; text-align: center; margin: 5px; color: #000000 !important;">
465
+ <div style="font-size: 2em; color: #000000 !important;">πŸ†</div>
466
+ <strong style="color: #000000 !important;">6. Ranking & Results</strong><br>
467
+ <small style="color: #000000 !important;">Top 5 matching trials are scored and displayed.</small>
468
+ </div>
469
+ """)
470
 
471
  gr.Markdown("## Start Matching")
472
  chatbot = gr.ChatInterface(