File size: 17,761 Bytes
8e4db5f
 
 
 
 
93a82f7
db36613
 
 
8e4db5f
 
81090ab
8e4db5f
 
db36613
 
590b7a2
 
db36613
 
 
590b7a2
db36613
590b7a2
 
 
93a82f7
 
 
b6c14bd
590b7a2
 
93a82f7
 
db36613
 
 
93a82f7
db36613
93a82f7
db36613
 
 
 
 
 
 
 
 
 
 
 
93a82f7
db36613
 
 
 
 
 
 
 
 
 
 
 
 
 
 
93a82f7
 
db36613
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
93a82f7
 
db36613
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
93a82f7
db36613
590b7a2
db36613
 
 
 
 
 
 
 
93a82f7
db36613
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
93a82f7
 
 
 
db36613
 
 
 
93a82f7
db36613
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
93a82f7
db36613
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
590b7a2
db36613
 
 
 
 
 
 
 
 
 
 
 
 
 
93a82f7
 
db36613
 
 
 
 
 
 
 
 
 
 
fabdbb6
db36613
 
 
 
 
 
 
 
 
 
 
 
 
590b7a2
db36613
 
 
590b7a2
db36613
93a82f7
 
db36613
 
 
 
93a82f7
613c65a
669f2fb
93a82f7
db36613
 
cfc185d
db36613
cfc185d
93a82f7
 
db36613
93a82f7
db36613
 
93a82f7
613c65a
db36613
93a82f7
db36613
 
93a82f7
db36613
 
93a82f7
 
db36613
93a82f7
db36613
 
93a82f7
 
db36613
93a82f7
db36613
 
 
 
 
93a82f7
 
db36613
93a82f7
590b7a2
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
db36613
93a82f7
db36613
590b7a2
db36613
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
93a82f7
 
db36613
 
 
93a82f7
db36613
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
590b7a2
db36613
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
bcf22e5
db36613
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
590b7a2
db36613
93a82f7
db36613
93a82f7
db36613
 
 
93a82f7
db36613
 
 
 
93a82f7
db36613
 
 
 
 
 
 
 
 
 
93a82f7
 
db36613
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
590b7a2
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
db36613
 
 
590b7a2
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
db36613
93a82f7
db36613
590b7a2
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537





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

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(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",
    "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 = """
            <span style='
                border:2px solid #168c44;
                color:#168c44;
                padding:4px 12px;
                border-radius:12px;
                font-size:0.85em;
                font-weight:600;
            '>
            • ACTIVE
            </span>
        """
    else:
        status_badge = """
            <span style='
                background:#6b7280;
                color:white;
                padding:4px 12px;
                border-radius:12px;
                font-size:0.85em;
                font-weight:600;
            '>
            COMING SOON
            </span>
        """

    features_html = "".join([f"<li style='margin:6px 0; color:#4b5563;'>{feature}</li>" for feature in features])

    if status == "active":
        button = f"""
            <a href="{url}" target="_blank" rel="noopener noreferrer"
            style='
                display:block;
                text-align:center;
                padding:14px;
                background:#204C6C;
                color:white;
                text-decoration:none;
                border-radius:16px;
                font-weight:600;
                font-size:1em;
                transition:0.25s ease;
            '
            onmouseover="this.style.transform='scale(1.04)'; this.style.opacity='0.92';"
            onmouseout="this.style.transform='scale(1)'; this.style.opacity='1';">
                Launch Agent
            </a>
        """
    else:
        button = """
            <div style='
                text-align:center;
                padding:14px;
                background:#e5e7eb;
                color:#6b7280;
                border-radius:10px;
                font-weight:600;
                font-size:1em;
                cursor:not-allowed;
            '>
                Coming Soon
            </div>
        """

    return f"""
        <div style='
            padding:28px;
            margin-top: 20px;
            background:white;
            min-height:400px;
            display:flex;   
            width:100%;
            flex-direction:column;
            justify-content:space-between;
            box-shadow:0px 6px 16px rgba(0,0,0,0.07);
            border-top:4px solid #204C6C;
        '>
            <div>
                <div style='display:flex; justify-content:space-between; align-items:center; margin-bottom:14px;'>
                    <h2 style='margin:0; color:#1f2937; font-size:1.45em;'>{title}</h2>
                    {status_badge}
                </div>

                <p style='color:#6b7280; margin:10px 0 18px 0; line-height:1.6; font-size:0.95em;'>
                    {description}
                </p>

                <div style='background:#f9fafb; padding:16px; border-radius:10px;'>
                    <h4 style='margin:0 0 0px 0; color:#374151; font-size:0.9em; font-weight:600;'>
                        KEY FEATURES:
                    </h4>
                    <ul style='margin:0; padding-left:18px;'>
                        {features_html}
                    </ul>
                </div>
            </div>

            <div style='margin-top:20px;'>{button}</div>
        </div>
    """


# ------------------------------------
# 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"""
<div style='
    padding:40px 30px;
    background:
        radial-gradient(circle at 20% 10%, rgba(255,255,255,0.25), transparent 55%),
        radial-gradient(circle at 85% 20%, rgba(45,135,255,0.22), transparent 70%),
        linear-gradient(135deg, #0e1a2b, #0f1032, #03011a);
    color:white;
    border-bottom-left-radius:40px;
    border-bottom-right-radius:40px;
    box-shadow:0 50px 90px -20px rgba(0,0,0,0.6);

    display:flex;
    justify-content:space-;
    align-items:center;
    width:100%;
'>

    <!-- LEFT: LOGO -->
    <div style="flex:1; display:flex; justify-content:flex-start; width: 100px;">
        <img src="{''}" width="120" style="margin-bottom:70px; opacity:0.95;">
    </div>

    <!-- CENTER: TITLE -->
    <div style="flex:1; display:flex; justify-content:center;">
        <h1 style='
            margin:0;
            font-size:2.5em;
            font-weight:800;
            letter-spacing:1px;
            background:linear-gradient(to right, #fff 20%, #dce4ff 40%, #cedcff 60%);
            -webkit-background-clip:text;
            color:transparent;
        '>
            Spark-Agent System
        </h1>
    </div>

    <div style="flex:1;"></div>

</div>

<div style='text-align: center;'>
 <p style='margin-top:20px; font-size:1.30em; opacity:0.92; color: white;'>
        Specialized AI Agents Crafted for Precision & Performance
    </p>

    <p style='margin-top:5px; font-size:1.05em; opacity:0.85; color: white;'>
        Task-focused intelligence working together to deliver accurate, efficient, and context-aware results across different workflows.
    </p>
</div>
""")


    # --------------------------------------
    # AVAILABLE AGENTS TITLE
    # --------------------------------------
    gr.HTML("""
        <div style='
            font-size:2.2em;
            text-align:center;
            font-weight:800;
            margin:60px 0 60px;
            color: white;
        '>
            Available Agents
            <hr style='margin:0px;'/>
        </div>
    """)

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

    <div style='
    margin-top: 80px;
    padding: 35px;
    background: linear-gradient(135deg, #e8f5ff 0%, #f3fff6 100%);
    border-radius: 18px;
    border-left: 6px solid #204c6c;
    box-shadow: 0px 8px 25px rgba(0,0,0,0.08);
'>

    <h3 style='
        margin:0 0 25px 0;
        font-size:1.8em;
        font-weight:800;
        color:#0e1a2b;
        letter-spacing:0.5px;
    '>
        System Status
    </h3>

    <div style='
        display:flex;
        gap:22px;
        flex-wrap:wrap;
    '>

        <!-- ACTIVE AGENTS -->
        <div style='
            flex:1;
            min-width:230px;
            text-align:center;
            padding:25px;
            background:rgba(255,255,255,0.75);
            border-radius:16px;
            border:1px solid rgba(32,76,108,0.18);
            backdrop-filter:blur(6px);
            box-shadow:0 4px 14px rgba(32,76,108,0.15);
            transition:0.3s ease;
        '
        onmouseover="this.style.transform='translateY(-6px)'; this.style.boxShadow='0 10px 28px rgba(32,76,108,0.25)';"
        onmouseout="this.style.transform='translateY(0)'; this.style.boxShadow='0 4px 14px rgba(32,76,108,0.15)';"
        >
            <div style='font-size:2.4em; color:#204c6c; font-weight:700;'>4</div>
            <div style='color:#334155; font-size:1em; margin-top:6px;'>Active Agents</div>
        </div>

        <!-- IN DEVELOPMENT -->
        <div style='
            flex:1;
            min-width:230px;
            text-align:center;
            padding:25px;
            background:rgba(255,255,255,0.75);
            border-radius:16px;
            border:1px solid rgba(32,76,108,0.18);
            backdrop-filter:blur(6px);
            box-shadow:0 4px 14px rgba(32,76,108,0.15);
            transition:0.3s ease;
        '
        onmouseover="this.style.transform='translateY(-6px)'; this.style.boxShadow='0 10px 28px rgba(32,76,108,0.25)';"
        onmouseout="this.style.transform='translateY(0)'; this.style.boxShadow='0 4px 14px rgba(32,76,108,0.15)';"
        >
            <div style='font-size:2.4em; color:#204c6c; font-weight:700;'>0</div>
            <div style='color:#334155; font-size:1em; margin-top:6px;'>In Development</div>
        </div>

        <!-- TOTAL AGENTS -->
        <div style='
            flex:1;
            min-width:230px;
            text-align:center;
            padding:25px;
            background:rgba(255,255,255,0.75);
            border-radius:16px;
            border:1px solid rgba(32,76,108,0.18);
            backdrop-filter:blur(6px);
            box-shadow:0 4px 14px rgba(32,76,108,0.15);
            transition:0.3s ease;
        '
        onmouseover="this.style.transform='translateY(-6px)'; this.style.boxShadow='0 10px 28px rgba(32,76,108,0.25)';"
        onmouseout="this.style.transform='translateY(0)'; this.style.boxShadow='0 4px 14px rgba(32,76,108,0.15)';"
        >
            <div style='font-size:2.4em; color:#204c6c; font-weight:700;'>4</div>
            <div style='color:#334155; font-size:1em; margin-top:6px;'>Total Agents</div>
        </div>

    </div>
</div>


    """)
 
    # -----------------------------------
    # HOW IT WORKS TITLE
    # -----------------------------------
    gr.HTML("""
        <div style='
            margin-top:60px;
            text-align:center;
            font-size:2.8em;
            font-weight:800;
            letter-spacing:1px;
            color: #ffffff;
        '>
            How It Works
        </div>
    """)

    with gr.Row():

        with gr.Column():   
            gr.HTML("""
                <div style='padding:20px 40px; text-align:left; margin-left: 130px; color: white;'>
                    <h3>Independent Agents</h3>
                    <ul>
                        <li>Isolated environments</li>
                        <li>Scalable + independently upgradable</li>
                        <li>Optimized resource allocation</li>
                        <li>Specialized task modules</li>
                    </ul>
                </div>
            """)

        with gr.Column():
            gr.HTML("""
                <div style='padding:20px 40px; text-align:left; margin-left: 130px;'>
                    <h3>Getting Started</h3>
                    <ul>
                        <li>Choose your agent</li>
                        <li>Click “Launch Agent”</li>
                        <li>Enter your query & receive instant results</li>
                        <li>Save or download output</li>
                    </ul>
                </div>
            """)

        with gr.Column():
            gr.HTML("""
                <div style='padding:20px 40px; text-align:left; margin-left: 130px;'>
                    <h3>Best Practices</h3>
                    <ul>
                        <li>Be specific with queries</li>
                        <li>Add relevant details</li>
                        <li>Use examples as guidance</li>
                        <li>Use agent-specific features</li>
                    </ul>
                </div>
            """)
#     gr.HTML("""
# <div style="
#     margin: 90px auto 40px;
#     text-align: center;
# ">
#     <a href="https://sparkbrains.ai" target="_blank" rel="noopener noreferrer"
#        style="
#         display: inline-block;
#         padding: 16px 38px;
#         font-size: 1.1em;
#         font-weight: 700;
#         color: white;
#         text-decoration: none;
#         border-top: 1px solid #168c44
#         border-radius: 999px;
#         background: linear-gradient(135deg, #204C6C, #168c44);
#         box-shadow: 0 10px 30px rgba(32, 76, 108, 0.35);
#         transition: all 0.3s ease;
#        "
#        onmouseover="this.style.transform='translateY(-4px)'; this.style.boxShadow='0 18px 40px rgba(32,76,108,0.45)'"
#        onmouseout="this.style.transform='translateY(0)'; this.style.boxShadow='0 10px 30px rgba(32,76,108,0.35)'"
#     >
#         Visit SparkBrains →
#     </a>

#     <p style="
#         margin-top: 14px;
#         font-size: 0.9em;
#         color: #cbd5f5;
#         opacity: 0.85;
#     ">
#         Explore our full AI ecosystem, products & research
#     </p>
# </div>
# """)

            

    # FOOTER --------------------------------------------------------------
    gr.HTML(f"""
<div class="spark-footer">

    <div class="footer-top">
        <a href="https://www.linkedin.com/company/sparkbrains/"
           target="_blank"
           class="icon-text-wrap">
            <img src="{linkedin_logo}" class="footer-icon"/>
            <span class="linkedin_text">LinkedIn</span>
        </a>

        <a href="mailto:sales@sparkbrains.in"
           class="icon-text-wrap">
            <img src="{email_logo}" class="footer-icon"/>
            <span class="linkedin_text">sales@sparkbrains.in</span>
        </a>
    </div>

    <a href="https://sparkbrains.in"
       target="_blank"
       rel="noopener noreferrer"
       class="footer-cta">
        Visit SparkBrains →
    </a>

    <div class="footer-bottom">
        © 2026 SparkBrains AI · Building Intelligent Systems
    </div>

</div>
""")


if __name__ == "__main__":
    demo.launch(share=True)
#   <h3 style='margin-bottom:10px;'>Built with Modern AI Stack</h3>
#             <p>DeepAgents • LangChain • Groq • OpenStreetMap • Gradio</p>
#             <p style='font-size:0.85em; color:#6b7280; margin-top:10px;'>
#                 HuggingFace Spaces | Open Source Architecture
#             </p>