Avishek8136 commited on
Commit
cce5403
·
1 Parent(s): eed65a1

Complete UI Redesign with Premium Glassmorphism Theme

Browse files
Files changed (1) hide show
  1. app.py +46 -15
app.py CHANGED
@@ -473,22 +473,53 @@ def generate_pdf_report(history: list, logs: str) -> str | None:
473
  pdf.output(tf.name)
474
  return tf.name
475
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
476
  CSS = """
477
- @import url('https://fonts.googleapis.com/css2?family=Outfit:wght@300;400;600;700&display=swap');
478
-
479
- .gradio-container { max-width: 1200px !important; margin: 0 auto !important; font-family: 'Outfit', sans-serif !important; background: linear-gradient(135deg, #0f172a 0%, #1e293b 100%) !important; color: #f8fafc !important; }
480
- body { background: #0f172a !important; }
481
- .main-header { text-align: center; padding: 24px 0 8px; animation: fadeIn 1s ease-in-out; }
482
- .main-header h1 { background: -webkit-linear-gradient(45deg, #38bdf8, #818cf8); -webkit-background-clip: text; -webkit-text-fill-color: transparent; font-size: 3rem; font-weight: 700; margin: 0; }
483
- .main-header p { color: #94a3b8; font-size: 1.1rem; margin: 8px 0 0; }
484
- .upload-box { border: 2px dashed #334155; border-radius: 12px; padding: 20px; background: rgba(30, 41, 59, 0.7); text-align: center; min-height: 220px; }
485
- .upload-box label { color: #94a3b8 !important; font-size: 0.85rem; }
486
- .output-panel { background: rgba(30, 41, 59, 0.7); border-radius: 12px; padding: 20px; min-height: 400px; }
487
- .log-panel { background: rgba(15, 23, 42, 0.8) !important; border: 1px solid #334155; border-radius: 10px; padding: 14px; font-size: 12px; font-family: 'Courier New', monospace; color: #4ade80 !important; max-height: 300px; overflow-y: auto; line-height: 1.5; box-shadow: inset 0 2px 10px rgba(0,0,0,0.5); }
488
- .diagnose-btn { background: linear-gradient(90deg, #3b82f6, #6366f1) !important; border: none !important; font-size: 1.05rem !important; font-weight: 600 !important; padding: 12px 32px !important; border-radius: 8px !important; color: white !important; box-shadow: 0 4px 15px rgba(59,130,246,0.4) !important; transition: all 0.3s ease !important; }
489
- .diagnose-btn:hover { transform: translateY(-2px) !important; box-shadow: 0 6px 20px rgba(99,102,241,0.6) !important; }
 
 
 
 
 
 
 
 
 
490
  footer { visibility: hidden; }
491
- @keyframes fadeIn { from { opacity: 0; transform: translateY(-10px); } to { opacity: 1; transform: translateY(0); } }
492
  """
493
 
494
  def create_gradio_ui():
@@ -534,7 +565,7 @@ def create_gradio_ui():
534
  hist = (hist or []) + [{"role": "user", "content": "👤 " + (msg or "[Image]")}, {"role": "assistant", "content": "🤖 " + answer}]
535
  return hist, "", state, logs
536
 
537
- with gr.Blocks(title="HyperDerm — AI Dermatology", css=CSS, theme=gr.themes.Soft()) as gradio_ui_blocks:
538
  gr.HTML('<div class="main-header"><h1>🏥 HyperDerm</h1><p>AI Dermatology — Neo4j Graph + NVIDIA Vision · 245 Diseases · 5 Agents</p></div>')
539
 
540
  with gr.Row(equal_height=True):
 
473
  pdf.output(tf.name)
474
  return tf.name
475
 
476
+ custom_theme = gr.themes.Base(
477
+ primary_hue="cyan",
478
+ secondary_hue="indigo",
479
+ neutral_hue="slate",
480
+ font=[gr.themes.GoogleFont("Outfit"), "sans-serif"],
481
+ ).set(
482
+ body_background_fill="linear-gradient(135deg, #09090b 0%, #18181b 100%)",
483
+ body_text_color="#f8fafc",
484
+ block_background_fill="rgba(39, 39, 42, 0.4)",
485
+ block_border_width="1px",
486
+ block_border_color="rgba(255, 255, 255, 0.08)",
487
+ block_radius="16px",
488
+ button_primary_background_fill="linear-gradient(135deg, #0ea5e9, #6366f1)",
489
+ button_primary_text_color="white",
490
+ button_primary_border_color="transparent",
491
+ button_secondary_background_fill="rgba(255, 255, 255, 0.05)",
492
+ button_secondary_border_color="rgba(255, 255, 255, 0.1)",
493
+ button_secondary_text_color="#f8fafc",
494
+ input_background_fill="rgba(0, 0, 0, 0.2)",
495
+ input_border_color="rgba(255, 255, 255, 0.1)",
496
+ )
497
+
498
  CSS = """
499
+ .gradio-container { max-width: 1200px !important; margin: 0 auto !important; }
500
+ body { background: transparent !important; }
501
+ .main-header { text-align: center; padding: 30px 0 10px; animation: fadeInDown 0.8s ease-out; }
502
+ .main-header h1 { background: -webkit-linear-gradient(45deg, #0ea5e9, #818cf8); -webkit-background-clip: text; -webkit-text-fill-color: transparent; font-size: 3.5rem; font-weight: 800; margin: 0; letter-spacing: -1px; }
503
+ .main-header p { color: #94a3b8; font-size: 1.15rem; margin: 8px 0 0; font-weight: 300; }
504
+
505
+ .upload-box, .output-panel { backdrop-filter: blur(16px); -webkit-backdrop-filter: blur(16px); box-shadow: 0 8px 32px 0 rgba(0, 0, 0, 0.4); }
506
+ .upload-box { border: 2px dashed rgba(255, 255, 255, 0.15) !important; padding: 25px; text-align: center; min-height: 240px; transition: all 0.3s ease; }
507
+ .upload-box:hover { border-color: #0ea5e9 !important; background: rgba(39, 39, 42, 0.6) !important; }
508
+
509
+ .chatbot { border: none !important; background: transparent !important; }
510
+ .message.user { background: linear-gradient(135deg, rgba(14, 165, 233, 0.15), rgba(99, 102, 241, 0.15)) !important; border: 1px solid rgba(14, 165, 233, 0.3) !important; }
511
+ .message.bot { background: rgba(0, 0, 0, 0.2) !important; border: 1px solid rgba(255, 255, 255, 0.05) !important; }
512
+
513
+ .log-panel { background: rgba(9, 9, 11, 0.8) !important; border: 1px solid rgba(255, 255, 255, 0.05) !important; border-radius: 12px; padding: 16px; font-size: 12.5px; font-family: 'JetBrains Mono', 'Courier New', monospace; color: #34d399 !important; box-shadow: inset 0 4px 20px rgba(0,0,0,0.6); line-height: 1.6; max-height: 300px; overflow-y: auto; }
514
+
515
+ .diagnose-btn { box-shadow: 0 4px 20px rgba(14, 165, 233, 0.3) !important; transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1) !important; }
516
+ .diagnose-btn:hover { transform: translateY(-3px) scale(1.02) !important; box-shadow: 0 8px 25px rgba(14, 165, 233, 0.5) !important; }
517
+
518
+ .test-gallery img { border-radius: 12px; border: 2px solid transparent; transition: all 0.4s ease; cursor: pointer; }
519
+ .test-gallery img:hover { border-color: #0ea5e9; transform: scale(1.08) translateY(-4px); box-shadow: 0 10px 20px rgba(0,0,0,0.4); }
520
+
521
  footer { visibility: hidden; }
522
+ @keyframes fadeInDown { from { opacity: 0; transform: translateY(-20px); } to { opacity: 1; transform: translateY(0); } }
523
  """
524
 
525
  def create_gradio_ui():
 
565
  hist = (hist or []) + [{"role": "user", "content": "👤 " + (msg or "[Image]")}, {"role": "assistant", "content": "🤖 " + answer}]
566
  return hist, "", state, logs
567
 
568
+ with gr.Blocks(title="HyperDerm — AI Dermatology", css=CSS, theme=custom_theme) as gradio_ui_blocks:
569
  gr.HTML('<div class="main-header"><h1>🏥 HyperDerm</h1><p>AI Dermatology — Neo4j Graph + NVIDIA Vision · 245 Diseases · 5 Agents</p></div>')
570
 
571
  with gr.Row(equal_height=True):