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/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/Tamannathakur/SparkMart" } # --------------------------- # 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}

    KEY FEATURES:

      {features_html}
    {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"""

    Spark-Agent System

    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" )) gr.HTML("""

    System Status

    3
    Active Agents
    0
    In Development
    3
    Total Agents
    """) # ----------------------------------- # HOW IT WORKS TITLE # ----------------------------------- gr.HTML("""
    How It Works
    """) with gr.Row(): with gr.Column(): gr.HTML("""

    Independent Agents

    """) with gr.Column(): gr.HTML("""

    Getting Started

    """) with gr.Column(): gr.HTML("""

    Best Practices

    """) # 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)