Spaces:
Sleeping
Sleeping
Update app.py
Browse files
app.py
CHANGED
|
@@ -10,6 +10,17 @@ from docx import Document
|
|
| 10 |
from docx.shared import Pt
|
| 11 |
|
| 12 |
# ---------- Branding ----------
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 13 |
APP_NAME = "ScholarLens"
|
| 14 |
TAGLINE = "Query your literature, get page-level proof"
|
| 15 |
|
|
@@ -331,21 +342,103 @@ theme = gr.themes.Soft(
|
|
| 331 |
with gr.Blocks(
|
| 332 |
title=f"{APP_NAME} | RAG over PDFs",
|
| 333 |
theme=theme,
|
| 334 |
-
css="""
|
| 335 |
-
|
| 336 |
-
|
| 337 |
-
|
| 338 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 339 |
border-radius: 12px;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 340 |
padding: 14px 16px;
|
| 341 |
-
|
| 342 |
-
|
| 343 |
-
|
| 344 |
-
|
| 345 |
-
|
| 346 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 347 |
"""
|
| 348 |
) as demo:
|
|
|
|
| 349 |
# --- Header / Hero ---
|
| 350 |
with gr.Group(elem_id="hero"):
|
| 351 |
gr.Markdown(
|
|
|
|
| 10 |
from docx.shared import Pt
|
| 11 |
|
| 12 |
# ---------- Branding ----------
|
| 13 |
+
# ---------- Palette ----------
|
| 14 |
+
PALETTE = {
|
| 15 |
+
"navy": "#083D77", # dark background
|
| 16 |
+
"gold": "#F2B400", # accents, primary buttons
|
| 17 |
+
"ice": "#FBF8F9", # off-white surfaces
|
| 18 |
+
"maroon": "#8B1E1E", # emphasis chips / dividers
|
| 19 |
+
"amber": "#F5C26B", # secondary accents
|
| 20 |
+
"text_on_dark": "#EAF2FF",
|
| 21 |
+
"text_on_light": "#0B1220",
|
| 22 |
+
}
|
| 23 |
+
|
| 24 |
APP_NAME = "ScholarLens"
|
| 25 |
TAGLINE = "Query your literature, get page-level proof"
|
| 26 |
|
|
|
|
| 342 |
with gr.Blocks(
|
| 343 |
title=f"{APP_NAME} | RAG over PDFs",
|
| 344 |
theme=theme,
|
| 345 |
+
css=f"""
|
| 346 |
+
:root {{
|
| 347 |
+
--navy: {PALETTE['navy']};
|
| 348 |
+
--gold: {PALETTE['gold']};
|
| 349 |
+
--ice: {PALETTE['ice']};
|
| 350 |
+
--maroon: {PALETTE['maroon']};
|
| 351 |
+
--amber: {PALETTE['amber']};
|
| 352 |
+
--text-dark: {PALETTE['text_on_light']};
|
| 353 |
+
--text-light: {PALETTE['text_on_dark']};
|
| 354 |
+
}}
|
| 355 |
+
|
| 356 |
+
body, .gradio-container {{
|
| 357 |
+
background: var(--navy) !important;
|
| 358 |
+
color: var(--text-light) !important;
|
| 359 |
+
}}
|
| 360 |
+
|
| 361 |
+
.gradio-container .block,
|
| 362 |
+
.gradio-container .tabs,
|
| 363 |
+
.gradio-container .tabs > .tabitem {{
|
| 364 |
+
background: color-mix(in srgb, var(--navy) 80%, black 20%) !important;
|
| 365 |
+
color: var(--text-light) !important;
|
| 366 |
border-radius: 12px;
|
| 367 |
+
border: 1px solid color-mix(in srgb, var(--navy) 70%, white 10%);
|
| 368 |
+
}}
|
| 369 |
+
|
| 370 |
+
#hero {{
|
| 371 |
+
background:
|
| 372 |
+
linear-gradient(90deg, var(--navy) 0%, var(--gold) 25%, var(--ice) 45%, var(--maroon) 65%, var(--amber) 85%, transparent 100%);
|
| 373 |
+
border: 1px solid color-mix(in srgb, var(--gold) 40%, white 20%);
|
| 374 |
+
border-radius: 14px;
|
| 375 |
padding: 14px 16px;
|
| 376 |
+
color: var(--text-light);
|
| 377 |
+
}}
|
| 378 |
+
|
| 379 |
+
a, .prose a {{
|
| 380 |
+
color: var(--amber) !important;
|
| 381 |
+
text-decoration: none;
|
| 382 |
+
}}
|
| 383 |
+
a:hover {{ text-decoration: underline; }}
|
| 384 |
+
|
| 385 |
+
.kpi {{
|
| 386 |
+
text-align:center;
|
| 387 |
+
padding:12px;
|
| 388 |
+
border-radius:10px;
|
| 389 |
+
border:1px solid color-mix(in srgb, var(--ice) 35%, var(--navy) 65%);
|
| 390 |
+
background: color-mix(in srgb, var(--navy) 75%, black 25%);
|
| 391 |
+
color: var(--text-light);
|
| 392 |
+
}}
|
| 393 |
+
|
| 394 |
+
button, .gr-button {{
|
| 395 |
+
border-radius: 10px !important;
|
| 396 |
+
font-weight: 600 !important;
|
| 397 |
+
color: var(--text-light) !important;
|
| 398 |
+
}}
|
| 399 |
+
button.primary, .gr-button-primary {{
|
| 400 |
+
background: var(--gold) !important;
|
| 401 |
+
color: var(--text-dark) !important;
|
| 402 |
+
border: 1px solid color-mix(in srgb, var(--gold) 70%, black 10%) !important;
|
| 403 |
+
}}
|
| 404 |
+
button.secondary, .gr-button-secondary {{
|
| 405 |
+
background: color-mix(in srgb, var(--amber) 60%, var(--gold) 40%) !important;
|
| 406 |
+
color: var(--text-dark) !important;
|
| 407 |
+
}}
|
| 408 |
+
|
| 409 |
+
input, textarea, .gr-textbox, .gr-text-area, .gr-slider, .gr-dropdown, .gr-file, .wrap.svelte* {{
|
| 410 |
+
background: color-mix(in srgb, var(--navy) 65%, black 35%) !important;
|
| 411 |
+
color: var(--text-light) !important;
|
| 412 |
+
border: 1px solid color-mix(in srgb, var(--ice) 25%, var(--navy) 75%) !important;
|
| 413 |
+
border-radius: 10px !important;
|
| 414 |
+
}}
|
| 415 |
+
|
| 416 |
+
label, .label, .prose h1, .prose h2, .prose h3, .prose p, .markdown-body {{
|
| 417 |
+
color: var(--text-light) !important;
|
| 418 |
+
}}
|
| 419 |
+
|
| 420 |
+
.dataframe, table, .table, .gr-dataframe * {{
|
| 421 |
+
color: var(--text-light) !important;
|
| 422 |
+
background: transparent !important;
|
| 423 |
+
}}
|
| 424 |
+
.dataframe th {{
|
| 425 |
+
background: color-mix(in srgb, var(--navy) 70%, black 30%) !important;
|
| 426 |
+
border-bottom: 1px solid color-mix(in srgb, var(--ice) 20%, var(--navy) 80%) !important;
|
| 427 |
+
}}
|
| 428 |
+
.dataframe td {{
|
| 429 |
+
border-bottom: 1px solid color-mix(in srgb, var(--ice) 15%, var(--navy) 85%) !important;
|
| 430 |
+
}}
|
| 431 |
+
|
| 432 |
+
.accordion, .gr-accordion {{
|
| 433 |
+
background: color-mix(in srgb, var(--navy) 70%, black 30%) !important;
|
| 434 |
+
border: 1px solid color-mix(in srgb, var(--ice) 20%, var(--navy) 80%) !important;
|
| 435 |
+
border-radius: 10px !important;
|
| 436 |
+
}}
|
| 437 |
+
|
| 438 |
+
footer, .footer {{ opacity:.75; color: var(--text-light); }}
|
| 439 |
"""
|
| 440 |
) as demo:
|
| 441 |
+
|
| 442 |
# --- Header / Hero ---
|
| 443 |
with gr.Group(elem_id="hero"):
|
| 444 |
gr.Markdown(
|