Spaces:
Build error
Build error
Upload folder using huggingface_hub
Browse files- deep_research.py +72 -55
- model_config.py +5 -5
deep_research.py
CHANGED
|
@@ -289,6 +289,10 @@ luntre_theme = gr.themes.Base(
|
|
| 289 |
|
| 290 |
# Custom CSS
|
| 291 |
custom_css = """
|
|
|
|
|
|
|
|
|
|
|
|
|
| 292 |
/* Global dark theme overrides */
|
| 293 |
.gradio-container {
|
| 294 |
background: linear-gradient(135deg, #1C1C1C 0%, #121212 100%) !important;
|
|
@@ -308,13 +312,15 @@ custom_css = """
|
|
| 308 |
|
| 309 |
.brand-name {
|
| 310 |
font-size: 2.5rem;
|
| 311 |
-
font-weight:
|
| 312 |
background: linear-gradient(135deg, #10B981 0%, #3B82F6 100%);
|
| 313 |
-webkit-background-clip: text;
|
| 314 |
-webkit-text-fill-color: transparent;
|
| 315 |
background-clip: text;
|
| 316 |
margin-bottom: 0.5rem;
|
| 317 |
-
letter-spacing:
|
|
|
|
|
|
|
| 318 |
}
|
| 319 |
|
| 320 |
.page-title {
|
|
@@ -469,45 +475,53 @@ textarea:focus {
|
|
| 469 |
/* Controls Row - Button + Model Selector */
|
| 470 |
.controls-row {
|
| 471 |
display: flex;
|
| 472 |
-
gap:
|
| 473 |
margin-top: 0.75rem;
|
| 474 |
-
align-items:
|
| 475 |
-
|
| 476 |
-
|
| 477 |
-
|
| 478 |
-
|
| 479 |
-
margin: 0 !important;
|
| 480 |
-
background: transparent !important;
|
| 481 |
-
border: none !important;
|
| 482 |
}
|
| 483 |
|
| 484 |
-
/* Model Radio Selector -
|
| 485 |
.model-radio {
|
| 486 |
display: flex !important;
|
| 487 |
-
flex-direction:
|
| 488 |
-
gap: 0.
|
| 489 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
| 490 |
}
|
| 491 |
|
| 492 |
-
.model-radio
|
| 493 |
-
color: #
|
| 494 |
font-size: 0.75rem !important;
|
| 495 |
-
font-weight:
|
| 496 |
-
margin-bottom: 0
|
| 497 |
-
text-transform: uppercase !important;
|
| 498 |
letter-spacing: 0.05em !important;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 499 |
}
|
| 500 |
|
| 501 |
.model-radio label {
|
| 502 |
-
background:
|
| 503 |
-
border:
|
| 504 |
color: #9CA3AF !important;
|
| 505 |
-
padding: 0.
|
| 506 |
-
border-radius:
|
| 507 |
-
font-size: 0.
|
| 508 |
font-weight: 500 !important;
|
| 509 |
cursor: pointer !important;
|
| 510 |
-
transition: all 0.2s
|
| 511 |
margin: 0 !important;
|
| 512 |
display: inline-flex !important;
|
| 513 |
align-items: center !important;
|
|
@@ -515,17 +529,20 @@ textarea:focus {
|
|
| 515 |
}
|
| 516 |
|
| 517 |
.model-radio label:hover {
|
| 518 |
-
background: rgba(16, 185, 129, 0.
|
| 519 |
border-color: rgba(16, 185, 129, 0.4) !important;
|
| 520 |
color: #10B981 !important;
|
|
|
|
|
|
|
| 521 |
}
|
| 522 |
|
| 523 |
.model-radio input[type="radio"]:checked + label,
|
| 524 |
.model-radio label.selected {
|
| 525 |
-
background: linear-gradient(135deg, rgba(16, 185, 129, 0.
|
| 526 |
-
border-color: rgba(16, 185, 129, 0.
|
| 527 |
color: #10B981 !important;
|
| 528 |
font-weight: 600 !important;
|
|
|
|
| 529 |
}
|
| 530 |
|
| 531 |
/* Hide the actual radio input */
|
|
@@ -537,25 +554,27 @@ textarea:focus {
|
|
| 537 |
background: linear-gradient(135deg, #10B981 0%, #059669 100%) !important;
|
| 538 |
border: none !important;
|
| 539 |
color: white !important;
|
| 540 |
-
border-radius:
|
| 541 |
font-weight: 600 !important;
|
| 542 |
-
padding: 0.
|
| 543 |
-
font-size: 0.
|
| 544 |
letter-spacing: 0.02em !important;
|
| 545 |
-
transition: all 0.
|
| 546 |
-
box-shadow: 0
|
| 547 |
-
width: 100% !important;
|
| 548 |
text-transform: uppercase !important;
|
|
|
|
|
|
|
| 549 |
}
|
| 550 |
|
| 551 |
.run-button:hover, button[variant="primary"]:hover {
|
| 552 |
-
transform: translateY(-
|
| 553 |
-
box-shadow: 0
|
|
|
|
| 554 |
}
|
| 555 |
|
| 556 |
.run-button:active, button[variant="primary"]:active {
|
| 557 |
transform: translateY(0) !important;
|
| 558 |
-
box-shadow: 0 1px
|
| 559 |
}
|
| 560 |
|
| 561 |
/* Modern Minimal Tabs */
|
|
@@ -823,23 +842,21 @@ with gr.Blocks(theme=luntre_theme, css=custom_css, title="Luntre AI - Deep Resea
|
|
| 823 |
)
|
| 824 |
|
| 825 |
with gr.Row(elem_classes="controls-row"):
|
| 826 |
-
|
| 827 |
-
|
| 828 |
-
|
| 829 |
-
|
| 830 |
-
|
| 831 |
-
|
| 832 |
-
|
| 833 |
-
|
| 834 |
-
|
| 835 |
-
|
| 836 |
-
|
| 837 |
-
|
| 838 |
-
|
| 839 |
-
|
| 840 |
-
|
| 841 |
-
interactive=True
|
| 842 |
-
)
|
| 843 |
|
| 844 |
# Hidden buttons for programmatic access
|
| 845 |
edit_btn = gr.Button("Edit", variant="secondary", visible=False, elem_id="edit-query-btn")
|
|
|
|
| 289 |
|
| 290 |
# Custom CSS
|
| 291 |
custom_css = """
|
| 292 |
+
/* Import stylish fonts */
|
| 293 |
+
@import url('https://fonts.googleapis.com/css2?family=Outfit:wght@300;400;500;600;700&display=swap');
|
| 294 |
+
@import url('https://fonts.googleapis.com/css2?family=Space+Grotesk:wght@300;400;500;600;700&display=swap');
|
| 295 |
+
|
| 296 |
/* Global dark theme overrides */
|
| 297 |
.gradio-container {
|
| 298 |
background: linear-gradient(135deg, #1C1C1C 0%, #121212 100%) !important;
|
|
|
|
| 312 |
|
| 313 |
.brand-name {
|
| 314 |
font-size: 2.5rem;
|
| 315 |
+
font-weight: 500;
|
| 316 |
background: linear-gradient(135deg, #10B981 0%, #3B82F6 100%);
|
| 317 |
-webkit-background-clip: text;
|
| 318 |
-webkit-text-fill-color: transparent;
|
| 319 |
background-clip: text;
|
| 320 |
margin-bottom: 0.5rem;
|
| 321 |
+
letter-spacing: 0.12em;
|
| 322 |
+
font-family: 'Space Grotesk', 'Outfit', sans-serif;
|
| 323 |
+
text-transform: uppercase;
|
| 324 |
}
|
| 325 |
|
| 326 |
.page-title {
|
|
|
|
| 475 |
/* Controls Row - Button + Model Selector */
|
| 476 |
.controls-row {
|
| 477 |
display: flex;
|
| 478 |
+
gap: 1rem;
|
| 479 |
margin-top: 0.75rem;
|
| 480 |
+
align-items: center;
|
| 481 |
+
background: transparent;
|
| 482 |
+
padding: 0;
|
| 483 |
+
border-radius: 0;
|
| 484 |
+
border: none;
|
|
|
|
|
|
|
|
|
|
| 485 |
}
|
| 486 |
|
| 487 |
+
/* Model Radio Selector - Inline with Label */
|
| 488 |
.model-radio {
|
| 489 |
display: flex !important;
|
| 490 |
+
flex-direction: column !important;
|
| 491 |
+
gap: 0.75rem !important;
|
| 492 |
+
background: rgba(28, 28, 28, 0.4);
|
| 493 |
+
padding: 1rem;
|
| 494 |
+
border-radius: 12px;
|
| 495 |
+
border: 1px solid rgba(55, 65, 81, 0.3);
|
| 496 |
+
flex: 1;
|
| 497 |
}
|
| 498 |
|
| 499 |
+
.model-radio > label:first-child {
|
| 500 |
+
color: #10B981 !important;
|
| 501 |
font-size: 0.75rem !important;
|
| 502 |
+
font-weight: 600 !important;
|
| 503 |
+
margin-bottom: 0 !important;
|
|
|
|
| 504 |
letter-spacing: 0.05em !important;
|
| 505 |
+
text-transform: uppercase;
|
| 506 |
+
}
|
| 507 |
+
|
| 508 |
+
.model-radio > div {
|
| 509 |
+
display: flex !important;
|
| 510 |
+
flex-direction: row !important;
|
| 511 |
+
gap: 0.5rem !important;
|
| 512 |
+
flex-wrap: wrap !important;
|
| 513 |
}
|
| 514 |
|
| 515 |
.model-radio label {
|
| 516 |
+
background: rgba(45, 45, 45, 0.6) !important;
|
| 517 |
+
border: 1.5px solid rgba(55, 65, 81, 0.6) !important;
|
| 518 |
color: #9CA3AF !important;
|
| 519 |
+
padding: 0.5rem 1rem !important;
|
| 520 |
+
border-radius: 8px !important;
|
| 521 |
+
font-size: 0.8rem !important;
|
| 522 |
font-weight: 500 !important;
|
| 523 |
cursor: pointer !important;
|
| 524 |
+
transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1) !important;
|
| 525 |
margin: 0 !important;
|
| 526 |
display: inline-flex !important;
|
| 527 |
align-items: center !important;
|
|
|
|
| 529 |
}
|
| 530 |
|
| 531 |
.model-radio label:hover {
|
| 532 |
+
background: rgba(16, 185, 129, 0.12) !important;
|
| 533 |
border-color: rgba(16, 185, 129, 0.4) !important;
|
| 534 |
color: #10B981 !important;
|
| 535 |
+
transform: translateY(-2px) scale(1.02) !important;
|
| 536 |
+
box-shadow: 0 4px 16px rgba(16, 185, 129, 0.25) !important;
|
| 537 |
}
|
| 538 |
|
| 539 |
.model-radio input[type="radio"]:checked + label,
|
| 540 |
.model-radio label.selected {
|
| 541 |
+
background: linear-gradient(135deg, rgba(16, 185, 129, 0.2), rgba(59, 130, 246, 0.15)) !important;
|
| 542 |
+
border-color: rgba(16, 185, 129, 0.8) !important;
|
| 543 |
color: #10B981 !important;
|
| 544 |
font-weight: 600 !important;
|
| 545 |
+
box-shadow: 0 2px 12px rgba(16, 185, 129, 0.3), inset 0 1px 2px rgba(16, 185, 129, 0.1) !important;
|
| 546 |
}
|
| 547 |
|
| 548 |
/* Hide the actual radio input */
|
|
|
|
| 554 |
background: linear-gradient(135deg, #10B981 0%, #059669 100%) !important;
|
| 555 |
border: none !important;
|
| 556 |
color: white !important;
|
| 557 |
+
border-radius: 10px !important;
|
| 558 |
font-weight: 600 !important;
|
| 559 |
+
padding: 0.875rem 2rem !important;
|
| 560 |
+
font-size: 0.95rem !important;
|
| 561 |
letter-spacing: 0.02em !important;
|
| 562 |
+
transition: all 0.25s ease !important;
|
| 563 |
+
box-shadow: 0 2px 8px rgba(16, 185, 129, 0.3), 0 1px 3px rgba(0, 0, 0, 0.2) !important;
|
|
|
|
| 564 |
text-transform: uppercase !important;
|
| 565 |
+
flex: 1;
|
| 566 |
+
max-width: 250px;
|
| 567 |
}
|
| 568 |
|
| 569 |
.run-button:hover, button[variant="primary"]:hover {
|
| 570 |
+
transform: translateY(-2px) !important;
|
| 571 |
+
box-shadow: 0 6px 20px rgba(16, 185, 129, 0.4), 0 2px 6px rgba(0, 0, 0, 0.25) !important;
|
| 572 |
+
background: linear-gradient(135deg, #059669 0%, #047857 100%) !important;
|
| 573 |
}
|
| 574 |
|
| 575 |
.run-button:active, button[variant="primary"]:active {
|
| 576 |
transform: translateY(0) !important;
|
| 577 |
+
box-shadow: 0 1px 3px rgba(0, 0, 0, 0.3) !important;
|
| 578 |
}
|
| 579 |
|
| 580 |
/* Modern Minimal Tabs */
|
|
|
|
| 842 |
)
|
| 843 |
|
| 844 |
with gr.Row(elem_classes="controls-row"):
|
| 845 |
+
run_btn = gr.Button("▶ Run Research", variant="primary", elem_classes="run-button")
|
| 846 |
+
|
| 847 |
+
model_selector = gr.Radio(
|
| 848 |
+
choices=[
|
| 849 |
+
"Gemini 2.5 Flash",
|
| 850 |
+
"Gemini 2.0 Flash",
|
| 851 |
+
"Gemini 2.0 Pro",
|
| 852 |
+
"Llama 3.3",
|
| 853 |
+
],
|
| 854 |
+
value="Gemini 2.5 Flash",
|
| 855 |
+
label="Choose Model",
|
| 856 |
+
show_label=True,
|
| 857 |
+
elem_classes="model-radio",
|
| 858 |
+
interactive=True
|
| 859 |
+
)
|
|
|
|
|
|
|
| 860 |
|
| 861 |
# Hidden buttons for programmatic access
|
| 862 |
edit_btn = gr.Button("Edit", variant="secondary", visible=False, elem_id="edit-query-btn")
|
model_config.py
CHANGED
|
@@ -15,23 +15,23 @@ def get_model(model_choice: str):
|
|
| 15 |
Returns:
|
| 16 |
OpenAIChatCompletionsModel configured for the selected model
|
| 17 |
"""
|
| 18 |
-
# Map
|
| 19 |
-
if "2.5
|
| 20 |
model_name = "gemini-2.5-flash"
|
| 21 |
api_key = os.getenv('GEMINI_API_KEY')
|
| 22 |
base_url = "https://generativelanguage.googleapis.com/v1beta/openai/"
|
| 23 |
|
| 24 |
-
elif "Pro" in model_choice:
|
| 25 |
model_name = "gemini-2.0-flash-thinking-exp-01-21"
|
| 26 |
api_key = os.getenv('GEMINI_API_KEY')
|
| 27 |
base_url = "https://generativelanguage.googleapis.com/v1beta/openai/"
|
| 28 |
|
| 29 |
-
elif "2.0
|
| 30 |
model_name = "gemini-2.0-flash-exp"
|
| 31 |
api_key = os.getenv('GEMINI_API_KEY')
|
| 32 |
base_url = "https://generativelanguage.googleapis.com/v1beta/openai/"
|
| 33 |
|
| 34 |
-
elif "Llama" in model_choice:
|
| 35 |
model_name = "llama-3.3-70b-versatile"
|
| 36 |
api_key = os.getenv('GROQ_API_KEY')
|
| 37 |
base_url = "https://api.groq.com/openai/v1"
|
|
|
|
| 15 |
Returns:
|
| 16 |
OpenAIChatCompletionsModel configured for the selected model
|
| 17 |
"""
|
| 18 |
+
# Map model names to configurations
|
| 19 |
+
if "2.5 Flash" in model_choice:
|
| 20 |
model_name = "gemini-2.5-flash"
|
| 21 |
api_key = os.getenv('GEMINI_API_KEY')
|
| 22 |
base_url = "https://generativelanguage.googleapis.com/v1beta/openai/"
|
| 23 |
|
| 24 |
+
elif "2.0 Pro" in model_choice:
|
| 25 |
model_name = "gemini-2.0-flash-thinking-exp-01-21"
|
| 26 |
api_key = os.getenv('GEMINI_API_KEY')
|
| 27 |
base_url = "https://generativelanguage.googleapis.com/v1beta/openai/"
|
| 28 |
|
| 29 |
+
elif "2.0 Flash" in model_choice:
|
| 30 |
model_name = "gemini-2.0-flash-exp"
|
| 31 |
api_key = os.getenv('GEMINI_API_KEY')
|
| 32 |
base_url = "https://generativelanguage.googleapis.com/v1beta/openai/"
|
| 33 |
|
| 34 |
+
elif "Llama 3.3" in model_choice:
|
| 35 |
model_name = "llama-3.3-70b-versatile"
|
| 36 |
api_key = os.getenv('GROQ_API_KEY')
|
| 37 |
base_url = "https://api.groq.com/openai/v1"
|