import gradio as gr
import os
import base64
BASE_DIR = os.path.dirname(os.path.abspath(__file__))
css_path = os.path.join(BASE_DIR, "style.css")
with open(css_path, "r") as f:
css = f.read()
logo_path = os.path.join(BASE_DIR, "main-logo.png")
def embed_image_base64(path):
with open(path, "rb") as f:
return "data:image/png;base64," + base64.b64encode(f.read()).decode()
logo_b64 = embed_image_base64(logo_path)
AGENT_URLS = {
"delivery": "https://huggingface.co/spaces/shuv25/optimize_delivery_system",
"agent2": "https://huggingface.co/spaces/Tamannathakur/SPARKNOVA",
"agent3": "https://huggingface.co/spaces/akankshar639/SparkMartAI"
}
# ---------------------------
# 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
Gain deeper insights from your datasets with intelligent automation. SparkNova helps you clean, analyze, and visualize data effortlessly.
""")
# --------------------------------------
# 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"
))
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
""")
# FOOTER --------------------------------------------------------------
# gr.HTML("""
#
#
Built with Modern AI Stack
#
DeepAgents • LangChain • Groq • OpenStreetMap • Gradio
#
# HuggingFace Spaces | Open Source Architecture
#
#
# """)
if __name__ == "__main__":
demo.launch(share=True)