import gradio as gr
import os
import base64
BASE_DIR = os.path.dirname(os.path.abspath(__file__))
css_path = os.path.join(BASE_DIR, "style1.css")
with open(css_path, "r") as f:
css = f.read()
logo_path = os.path.join(BASE_DIR, "public/linkedin.png")
email_path = os.path.join(BASE_DIR, "public/email_icon.png")
main_logo = os.path.join(BASE_DIR, "public/main-logo.png")
def embed_image_base64(path):
with open(path, "rb") as f:
return "data:image/svg;base64," + base64.b64encode(f.read()).decode()
linkedin_logo = embed_image_base64(logo_path)
email_logo = embed_image_base64(email_path)
logo_b64 = embed_image_base64(main_logo)
AGENT_URLS = {
"delivery": "https://huggingface.co/spaces/shuv25/optimize_delivery_system",
"agent2": "https://huggingface.co/spaces/Tamannathakur/SPARKNOVA",
"agent3": "https://huggingface.co/spaces/Tamannathakur/SparkMart",
"agent4": "https://huggingface.co/spaces/SparkBrainsAI/AI_Trade_Analyzer"
}
# ---------------------------
# PREMIUM CARD COMPONENT
# ---------------------------
def create_agent_card(title, description, features, url, color, status="active"):
if status == "active":
status_badge = """
• ACTIVE
"""
else:
status_badge = """
COMING SOON
"""
features_html = "".join([f"
{feature}" for feature in features])
if status == "active":
button = f"""
Launch Agent
"""
else:
button = """
Coming Soon
"""
return f"""
{title}
{status_badge}
{description}
{button}
"""
# ------------------------------------
# MAIN UI (ENHANCED LAYOUT)
# ------------------------------------
with gr.Blocks(
theme=gr.themes.Soft(primary_hue="green"),
title="Spark-Agent System",
# css="""
# body, html {
# margin:0;
# padding:0;
# width:100%;
# overflow-x:hidden;
# font-family: Georgia, serif;
# background-color: #17203D;
# }
# .gradio-container {
# max-width: 1900px !important;
# # background-color: #17203D;
# margin:auto !important;
# }
# """
css=css
) as demo:
# HEADER SECTION -----------------------------------------------------
gr.HTML(f"""
Specialized AI Agents Crafted for Precision & Performance
Task-focused intelligence working together to deliver accurate, efficient, and context-aware results across different workflows.
""")
# --------------------------------------
# AVAILABLE AGENTS TITLE
# --------------------------------------
gr.HTML("""
Available Agents
""")
# AGENT GRID ---------------------------------------------------------
with gr.Row(equal_height=True):
with gr.Column(scale=1):
gr.HTML(create_agent_card(
title="SparkDelivery",
description="AI-powered logistics assistant that plans optimal routes, analyzes traffic and weather conditions, estimates delivery costs, and optimizes multi-stop deliveries with intelligent vehicle recommendations.",
features=[
"Interactive route planning",
"Multi-destination optimization",
"Real-time traffic analysis",
"Weather forecasting",
"Smart cost estimation"
],
url=AGENT_URLS["delivery"],
color="#164d8c"
))
with gr.Column(scale=1):
gr.HTML(create_agent_card(
title="SparkNova",
description="SparkNova is an AI-powered data analysis tool that automatically explores, visualizes, and generates insights from uploaded CSV datasets through natural language queries efficiently.",
features=[
"AI-driven Query Understanding",
"Smart Visualizations",
"Insight Generation",
"Time-Efficient Analysis",
"Decision Support"
],
url=AGENT_URLS["agent2"],
color="#168c44"
))
with gr.Column(scale=1):
gr.HTML(create_agent_card(
title="SparkMart AI",
description="""SparkMart AI is a chatbot for e-commerce customer service, automating order tracking, resolving complaints, and offering personalized and specific product recommendations to customers.""",
features=[
"Order Management",
"Personalized Recommendations",
"Complaint Resolution",
"Conversational State",
"Query Assistance"
],
url=AGENT_URLS["agent3"],
color="#168c44"
))
with gr.Column(scale=1):
gr.HTML(create_agent_card(
title="SparkTrade Analyzer",
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.""",
features=[
"AI-driven Stock Analysis",
"Technical Indicator Evaluation",
"Intraday Trade Signals",
"Risk & Confidence Scoring",
"Visual Price Trend Insights"
],
url=AGENT_URLS["agent4"],
color="#168c44"
))
with gr.Column(scale=1):
gr.HTML('')
with gr.Column(scale=1):
gr.HTML('')
gr.HTML("""
""")
# -----------------------------------
# HOW IT WORKS TITLE
# -----------------------------------
gr.HTML("""
How It Works
""")
with gr.Row():
with gr.Column():
gr.HTML("""
Independent Agents
- Isolated environments
- Scalable + independently upgradable
- Optimized resource allocation
- Specialized task modules
""")
with gr.Column():
gr.HTML("""
Getting Started
- Choose your agent
- Click “Launch Agent”
- Enter your query & receive instant results
- Save or download output
""")
with gr.Column():
gr.HTML("""
Best Practices
- Be specific with queries
- Add relevant details
- Use examples as guidance
- Use agent-specific features
""")
# gr.HTML("""
#
# """)
# FOOTER --------------------------------------------------------------
gr.HTML(f"""
""")
if __name__ == "__main__":
demo.launch(share=True)
# Built with Modern AI Stack
# DeepAgents • LangChain • Groq • OpenStreetMap • Gradio
#
# HuggingFace Spaces | Open Source Architecture
#