Spaces:
Sleeping
Sleeping
Update app.py
#5
by Tamannathakur - opened
app.py
CHANGED
|
@@ -14,22 +14,22 @@ css_path = os.path.join(BASE_DIR, "style1.css")
|
|
| 14 |
with open(css_path, "r") as f:
|
| 15 |
css = f.read()
|
| 16 |
|
| 17 |
-
|
| 18 |
-
|
| 19 |
-
|
| 20 |
-
|
| 21 |
-
logo_path = os.path.join(BASE_DIR, "public/main-logo.png")
|
| 22 |
|
| 23 |
def embed_image_base64(path):
|
| 24 |
with open(path, "rb") as f:
|
| 25 |
-
return "data:image/
|
| 26 |
|
| 27 |
-
|
|
|
|
|
|
|
| 28 |
|
| 29 |
AGENT_URLS = {
|
| 30 |
"delivery": "https://huggingface.co/spaces/shuv25/optimize_delivery_system",
|
| 31 |
"agent2": "https://huggingface.co/spaces/Tamannathakur/SPARKNOVA",
|
| 32 |
-
"agent3": "https://huggingface.co/spaces/Tamannathakur/SparkMart"
|
|
|
|
| 33 |
}
|
| 34 |
|
| 35 |
# ---------------------------
|
|
@@ -105,6 +105,7 @@ def create_agent_card(title, description, features, url, color, status="active")
|
|
| 105 |
return f"""
|
| 106 |
<div style='
|
| 107 |
padding:28px;
|
|
|
|
| 108 |
background:white;
|
| 109 |
min-height:400px;
|
| 110 |
display:flex;
|
|
@@ -187,7 +188,7 @@ with gr.Blocks(
|
|
| 187 |
|
| 188 |
<!-- LEFT: LOGO -->
|
| 189 |
<div style="flex:1; display:flex; justify-content:flex-start; width: 100px;">
|
| 190 |
-
<img src="{
|
| 191 |
</div>
|
| 192 |
|
| 193 |
<!-- CENTER: TITLE -->
|
|
@@ -229,10 +230,11 @@ with gr.Blocks(
|
|
| 229 |
font-size:2.2em;
|
| 230 |
text-align:center;
|
| 231 |
font-weight:800;
|
| 232 |
-
margin:
|
| 233 |
color: white;
|
| 234 |
'>
|
| 235 |
Available Agents
|
|
|
|
| 236 |
</div>
|
| 237 |
""")
|
| 238 |
|
|
@@ -283,11 +285,32 @@ with gr.Blocks(
|
|
| 283 |
url=AGENT_URLS["agent3"],
|
| 284 |
color="#168c44"
|
| 285 |
))
|
| 286 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 287 |
gr.HTML("""
|
| 288 |
|
| 289 |
<div style='
|
| 290 |
-
margin-top:
|
| 291 |
padding: 35px;
|
| 292 |
background: linear-gradient(135deg, #e8f5ff 0%, #f3fff6 100%);
|
| 293 |
border-radius: 18px;
|
|
@@ -327,7 +350,7 @@ with gr.Blocks(
|
|
| 327 |
onmouseover="this.style.transform='translateY(-6px)'; this.style.boxShadow='0 10px 28px rgba(32,76,108,0.25)';"
|
| 328 |
onmouseout="this.style.transform='translateY(0)'; this.style.boxShadow='0 4px 14px rgba(32,76,108,0.15)';"
|
| 329 |
>
|
| 330 |
-
<div style='font-size:2.4em; color:#204c6c; font-weight:700;'>
|
| 331 |
<div style='color:#334155; font-size:1em; margin-top:6px;'>Active Agents</div>
|
| 332 |
</div>
|
| 333 |
|
|
@@ -367,7 +390,7 @@ with gr.Blocks(
|
|
| 367 |
onmouseover="this.style.transform='translateY(-6px)'; this.style.boxShadow='0 10px 28px rgba(32,76,108,0.25)';"
|
| 368 |
onmouseout="this.style.transform='translateY(0)'; this.style.boxShadow='0 4px 14px rgba(32,76,108,0.15)';"
|
| 369 |
>
|
| 370 |
-
<div style='font-size:2.4em; color:#204c6c; font-weight:700;'>
|
| 371 |
<div style='color:#334155; font-size:1em; margin-top:6px;'>Total Agents</div>
|
| 372 |
</div>
|
| 373 |
|
|
@@ -433,26 +456,82 @@ with gr.Blocks(
|
|
| 433 |
</ul>
|
| 434 |
</div>
|
| 435 |
""")
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 436 |
|
| 437 |
|
| 438 |
# FOOTER --------------------------------------------------------------
|
| 439 |
-
|
| 440 |
-
|
| 441 |
-
|
| 442 |
-
|
| 443 |
-
|
| 444 |
-
|
| 445 |
-
|
| 446 |
-
|
| 447 |
-
|
| 448 |
-
|
| 449 |
-
|
| 450 |
-
|
| 451 |
-
|
| 452 |
-
|
| 453 |
-
|
| 454 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 455 |
|
| 456 |
if __name__ == "__main__":
|
| 457 |
demo.launch(share=True)
|
| 458 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 14 |
with open(css_path, "r") as f:
|
| 15 |
css = f.read()
|
| 16 |
|
| 17 |
+
logo_path = os.path.join(BASE_DIR, "public/linkedin.png")
|
| 18 |
+
email_path = os.path.join(BASE_DIR, "public/email_icon.png")
|
|
|
|
|
|
|
|
|
|
| 19 |
|
| 20 |
def embed_image_base64(path):
|
| 21 |
with open(path, "rb") as f:
|
| 22 |
+
return "data:image/svg;base64," + base64.b64encode(f.read()).decode()
|
| 23 |
|
| 24 |
+
linkedin_logo = embed_image_base64(logo_path)
|
| 25 |
+
email_logo = embed_image_base64(email_path)
|
| 26 |
+
# logo_b64 = embed_image_base64(logo_path)
|
| 27 |
|
| 28 |
AGENT_URLS = {
|
| 29 |
"delivery": "https://huggingface.co/spaces/shuv25/optimize_delivery_system",
|
| 30 |
"agent2": "https://huggingface.co/spaces/Tamannathakur/SPARKNOVA",
|
| 31 |
+
"agent3": "https://huggingface.co/spaces/Tamannathakur/SparkMart",
|
| 32 |
+
"agent4": "https://huggingface.co/spaces/SparkBrainsAI/AI_Trade_Analyzer"
|
| 33 |
}
|
| 34 |
|
| 35 |
# ---------------------------
|
|
|
|
| 105 |
return f"""
|
| 106 |
<div style='
|
| 107 |
padding:28px;
|
| 108 |
+
margin-top: 20px;
|
| 109 |
background:white;
|
| 110 |
min-height:400px;
|
| 111 |
display:flex;
|
|
|
|
| 188 |
|
| 189 |
<!-- LEFT: LOGO -->
|
| 190 |
<div style="flex:1; display:flex; justify-content:flex-start; width: 100px;">
|
| 191 |
+
<img src="{''}" width="120" style="margin-bottom:70px; opacity:0.95;">
|
| 192 |
</div>
|
| 193 |
|
| 194 |
<!-- CENTER: TITLE -->
|
|
|
|
| 230 |
font-size:2.2em;
|
| 231 |
text-align:center;
|
| 232 |
font-weight:800;
|
| 233 |
+
margin:60px 0 60px;
|
| 234 |
color: white;
|
| 235 |
'>
|
| 236 |
Available Agents
|
| 237 |
+
<hr style='margin:0px;'/>
|
| 238 |
</div>
|
| 239 |
""")
|
| 240 |
|
|
|
|
| 285 |
url=AGENT_URLS["agent3"],
|
| 286 |
color="#168c44"
|
| 287 |
))
|
| 288 |
+
|
| 289 |
+
with gr.Column(scale=1):
|
| 290 |
+
gr.HTML(create_agent_card(
|
| 291 |
+
title="SparkTrade Analyzer",
|
| 292 |
+
description="""SparkTrade Analyzer is an AI-powered trading intelligence agent that analyzes stock market queries, evaluates technical indicators, and generates actionable intraday insights to support smarter trading decisions.""",
|
| 293 |
+
features=[
|
| 294 |
+
"AI-driven Stock Analysis",
|
| 295 |
+
"Technical Indicator Evaluation",
|
| 296 |
+
"Intraday Trade Signals",
|
| 297 |
+
"Risk & Confidence Scoring",
|
| 298 |
+
"Visual Price Trend Insights"
|
| 299 |
+
],
|
| 300 |
+
url=AGENT_URLS["agent4"],
|
| 301 |
+
color="#168c44"
|
| 302 |
+
))
|
| 303 |
+
|
| 304 |
+
with gr.Column(scale=1):
|
| 305 |
+
gr.HTML('')
|
| 306 |
+
|
| 307 |
+
with gr.Column(scale=1):
|
| 308 |
+
gr.HTML('')
|
| 309 |
+
|
| 310 |
gr.HTML("""
|
| 311 |
|
| 312 |
<div style='
|
| 313 |
+
margin-top: 80px;
|
| 314 |
padding: 35px;
|
| 315 |
background: linear-gradient(135deg, #e8f5ff 0%, #f3fff6 100%);
|
| 316 |
border-radius: 18px;
|
|
|
|
| 350 |
onmouseover="this.style.transform='translateY(-6px)'; this.style.boxShadow='0 10px 28px rgba(32,76,108,0.25)';"
|
| 351 |
onmouseout="this.style.transform='translateY(0)'; this.style.boxShadow='0 4px 14px rgba(32,76,108,0.15)';"
|
| 352 |
>
|
| 353 |
+
<div style='font-size:2.4em; color:#204c6c; font-weight:700;'>4</div>
|
| 354 |
<div style='color:#334155; font-size:1em; margin-top:6px;'>Active Agents</div>
|
| 355 |
</div>
|
| 356 |
|
|
|
|
| 390 |
onmouseover="this.style.transform='translateY(-6px)'; this.style.boxShadow='0 10px 28px rgba(32,76,108,0.25)';"
|
| 391 |
onmouseout="this.style.transform='translateY(0)'; this.style.boxShadow='0 4px 14px rgba(32,76,108,0.15)';"
|
| 392 |
>
|
| 393 |
+
<div style='font-size:2.4em; color:#204c6c; font-weight:700;'>4</div>
|
| 394 |
<div style='color:#334155; font-size:1em; margin-top:6px;'>Total Agents</div>
|
| 395 |
</div>
|
| 396 |
|
|
|
|
| 456 |
</ul>
|
| 457 |
</div>
|
| 458 |
""")
|
| 459 |
+
# gr.HTML("""
|
| 460 |
+
# <div style="
|
| 461 |
+
# margin: 90px auto 40px;
|
| 462 |
+
# text-align: center;
|
| 463 |
+
# ">
|
| 464 |
+
# <a href="https://sparkbrains.ai" target="_blank" rel="noopener noreferrer"
|
| 465 |
+
# style="
|
| 466 |
+
# display: inline-block;
|
| 467 |
+
# padding: 16px 38px;
|
| 468 |
+
# font-size: 1.1em;
|
| 469 |
+
# font-weight: 700;
|
| 470 |
+
# color: white;
|
| 471 |
+
# text-decoration: none;
|
| 472 |
+
# border-top: 1px solid #168c44
|
| 473 |
+
# border-radius: 999px;
|
| 474 |
+
# background: linear-gradient(135deg, #204C6C, #168c44);
|
| 475 |
+
# box-shadow: 0 10px 30px rgba(32, 76, 108, 0.35);
|
| 476 |
+
# transition: all 0.3s ease;
|
| 477 |
+
# "
|
| 478 |
+
# onmouseover="this.style.transform='translateY(-4px)'; this.style.boxShadow='0 18px 40px rgba(32,76,108,0.45)'"
|
| 479 |
+
# onmouseout="this.style.transform='translateY(0)'; this.style.boxShadow='0 10px 30px rgba(32,76,108,0.35)'"
|
| 480 |
+
# >
|
| 481 |
+
# Visit SparkBrains →
|
| 482 |
+
# </a>
|
| 483 |
+
|
| 484 |
+
# <p style="
|
| 485 |
+
# margin-top: 14px;
|
| 486 |
+
# font-size: 0.9em;
|
| 487 |
+
# color: #cbd5f5;
|
| 488 |
+
# opacity: 0.85;
|
| 489 |
+
# ">
|
| 490 |
+
# Explore our full AI ecosystem, products & research
|
| 491 |
+
# </p>
|
| 492 |
+
# </div>
|
| 493 |
+
# """)
|
| 494 |
+
|
| 495 |
|
| 496 |
|
| 497 |
# FOOTER --------------------------------------------------------------
|
| 498 |
+
gr.HTML(f"""
|
| 499 |
+
<div class="spark-footer">
|
| 500 |
+
|
| 501 |
+
<div class="footer-top">
|
| 502 |
+
<a href="https://www.linkedin.com/company/sparkbrains/"
|
| 503 |
+
target="_blank"
|
| 504 |
+
class="icon-text-wrap">
|
| 505 |
+
<img src="{linkedin_logo}" class="footer-icon"/>
|
| 506 |
+
<span class="linkedin_text">LinkedIn</span>
|
| 507 |
+
</a>
|
| 508 |
+
|
| 509 |
+
<a href="mailto:sales@sparkbrains.in"
|
| 510 |
+
class="icon-text-wrap">
|
| 511 |
+
<img src="{email_logo}" class="footer-icon"/>
|
| 512 |
+
<span class="linkedin_text">sales@sparkbrains.in</span>
|
| 513 |
+
</a>
|
| 514 |
+
</div>
|
| 515 |
+
|
| 516 |
+
<a href="https://sparkbrains.in"
|
| 517 |
+
target="_blank"
|
| 518 |
+
rel="noopener noreferrer"
|
| 519 |
+
class="footer-cta">
|
| 520 |
+
Visit SparkBrains →
|
| 521 |
+
</a>
|
| 522 |
+
|
| 523 |
+
<div class="footer-bottom">
|
| 524 |
+
© 2026 SparkBrains AI · Building Intelligent Systems
|
| 525 |
+
</div>
|
| 526 |
+
|
| 527 |
+
</div>
|
| 528 |
+
""")
|
| 529 |
+
|
| 530 |
|
| 531 |
if __name__ == "__main__":
|
| 532 |
demo.launch(share=True)
|
| 533 |
+
# <h3 style='margin-bottom:10px;'>Built with Modern AI Stack</h3>
|
| 534 |
+
# <p>DeepAgents • LangChain • Groq • OpenStreetMap • Gradio</p>
|
| 535 |
+
# <p style='font-size:0.85em; color:#6b7280; margin-top:10px;'>
|
| 536 |
+
# HuggingFace Spaces | Open Source Architecture
|
| 537 |
+
# </p>
|