shuv25 commited on
Commit
9eb6156
·
verified ·
1 Parent(s): 6de6c67

Delete app.py

Browse files
Files changed (1) hide show
  1. app.py +0 -458
app.py DELETED
@@ -1,458 +0,0 @@
1
-
2
-
3
-
4
-
5
-
6
- import gradio as gr
7
- import os
8
- import base64
9
-
10
-
11
- BASE_DIR = os.path.dirname(os.path.abspath(__file__))
12
- css_path = os.path.join(BASE_DIR, "style1.css")
13
-
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/png;base64," + base64.b64encode(f.read()).decode()
26
-
27
- logo_b64 = embed_image_base64(logo_path)
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
- # ---------------------------
36
- # PREMIUM CARD COMPONENT
37
- # ---------------------------
38
- def create_agent_card(title, description, features, url, color, status="active"):
39
-
40
- if status == "active":
41
- status_badge = """
42
- <span style='
43
- border:2px solid #168c44;
44
- color:#168c44;
45
- padding:4px 12px;
46
- border-radius:12px;
47
- font-size:0.85em;
48
- font-weight:600;
49
- '>
50
- • ACTIVE
51
- </span>
52
- """
53
- else:
54
- status_badge = """
55
- <span style='
56
- background:#6b7280;
57
- color:white;
58
- padding:4px 12px;
59
- border-radius:12px;
60
- font-size:0.85em;
61
- font-weight:600;
62
- '>
63
- COMING SOON
64
- </span>
65
- """
66
-
67
- features_html = "".join([f"<li style='margin:6px 0; color:#4b5563;'>{feature}</li>" for feature in features])
68
-
69
- if status == "active":
70
- button = f"""
71
- <a href="{url}" target="_blank" rel="noopener noreferrer"
72
- style='
73
- display:block;
74
- text-align:center;
75
- padding:14px;
76
- background:#204C6C;
77
- color:white;
78
- text-decoration:none;
79
- border-radius:16px;
80
- font-weight:600;
81
- font-size:1em;
82
- transition:0.25s ease;
83
- '
84
- onmouseover="this.style.transform='scale(1.04)'; this.style.opacity='0.92';"
85
- onmouseout="this.style.transform='scale(1)'; this.style.opacity='1';">
86
- Launch Agent
87
- </a>
88
- """
89
- else:
90
- button = """
91
- <div style='
92
- text-align:center;
93
- padding:14px;
94
- background:#e5e7eb;
95
- color:#6b7280;
96
- border-radius:10px;
97
- font-weight:600;
98
- font-size:1em;
99
- cursor:not-allowed;
100
- '>
101
- Coming Soon
102
- </div>
103
- """
104
-
105
- return f"""
106
- <div style='
107
- padding:28px;
108
- background:white;
109
- min-height:400px;
110
- display:flex;
111
- width:100%;
112
- flex-direction:column;
113
- justify-content:space-between;
114
- box-shadow:0px 6px 16px rgba(0,0,0,0.07);
115
- border-top:4px solid #204C6C;
116
- '>
117
- <div>
118
- <div style='display:flex; justify-content:space-between; align-items:center; margin-bottom:14px;'>
119
- <h2 style='margin:0; color:#1f2937; font-size:1.45em;'>{title}</h2>
120
- {status_badge}
121
- </div>
122
-
123
- <p style='color:#6b7280; margin:10px 0 18px 0; line-height:1.6; font-size:0.95em;'>
124
- {description}
125
- </p>
126
-
127
- <div style='background:#f9fafb; padding:16px; border-radius:10px;'>
128
- <h4 style='margin:0 0 0px 0; color:#374151; font-size:0.9em; font-weight:600;'>
129
- KEY FEATURES:
130
- </h4>
131
- <ul style='margin:0; padding-left:18px;'>
132
- {features_html}
133
- </ul>
134
- </div>
135
- </div>
136
-
137
- <div style='margin-top:20px;'>{button}</div>
138
- </div>
139
- """
140
-
141
-
142
- # ------------------------------------
143
- # MAIN UI (ENHANCED LAYOUT)
144
- # ------------------------------------
145
-
146
- with gr.Blocks(
147
- theme=gr.themes.Soft(primary_hue="green"),
148
- title="Spark-Agent System",
149
- # css="""
150
- # body, html {
151
- # margin:0;
152
- # padding:0;
153
- # width:100%;
154
- # overflow-x:hidden;
155
- # font-family: Georgia, serif;
156
- # background-color: #17203D;
157
- # }
158
-
159
- # .gradio-container {
160
- # max-width: 1900px !important;
161
- # # background-color: #17203D;
162
- # margin:auto !important;
163
- # }
164
- # """
165
- css=css
166
-
167
- ) as demo:
168
-
169
- # HEADER SECTION -----------------------------------------------------
170
- gr.HTML(f"""
171
- <div style='
172
- padding:40px 30px;
173
- background:
174
- radial-gradient(circle at 20% 10%, rgba(255,255,255,0.25), transparent 55%),
175
- radial-gradient(circle at 85% 20%, rgba(45,135,255,0.22), transparent 70%),
176
- linear-gradient(135deg, #0e1a2b, #0f1032, #03011a);
177
- color:white;
178
- border-bottom-left-radius:40px;
179
- border-bottom-right-radius:40px;
180
- box-shadow:0 50px 90px -20px rgba(0,0,0,0.6);
181
-
182
- display:flex;
183
- justify-content:space-;
184
- align-items:center;
185
- width:100%;
186
- '>
187
-
188
- <!-- LEFT: LOGO -->
189
- <div style="flex:1; display:flex; justify-content:flex-start; width: 100px;">
190
- <img src="{logo_b64}" width="120" style="margin-bottom:70px; opacity:0.95;">
191
- </div>
192
-
193
- <!-- CENTER: TITLE -->
194
- <div style="flex:1; display:flex; justify-content:center;">
195
- <h1 style='
196
- margin:0;
197
- font-size:2.5em;
198
- font-weight:800;
199
- letter-spacing:1px;
200
- background:linear-gradient(to right, #fff 20%, #dce4ff 40%, #cedcff 60%);
201
- -webkit-background-clip:text;
202
- color:transparent;
203
- '>
204
- Spark-Agent System
205
- </h1>
206
- </div>
207
-
208
- <div style="flex:1;"></div>
209
-
210
- </div>
211
-
212
- <div style='text-align: center;'>
213
- <p style='margin-top:20px; font-size:1.30em; opacity:0.92; color: white;'>
214
- Specialized AI Agents Crafted for Precision & Performance
215
- </p>
216
-
217
- <p style='margin-top:5px; font-size:1.05em; opacity:0.85; color: white;'>
218
- Task-focused intelligence working together to deliver accurate, efficient, and context-aware results across different workflows.
219
- </p>
220
- </div>
221
- """)
222
-
223
-
224
- # --------------------------------------
225
- # AVAILABLE AGENTS TITLE
226
- # --------------------------------------
227
- gr.HTML("""
228
- <div style='
229
- font-size:2.2em;
230
- text-align:center;
231
- font-weight:800;
232
- margin:30px 0 40px;
233
- color: white;
234
- '>
235
- Available Agents
236
- </div>
237
- """)
238
-
239
- # AGENT GRID ---------------------------------------------------------
240
- with gr.Row(equal_height=True):
241
-
242
- with gr.Column(scale=1):
243
- gr.HTML(create_agent_card(
244
- title="SparkDelivery",
245
- 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.",
246
- features=[
247
- "Interactive route planning",
248
- "Multi-destination optimization",
249
- "Real-time traffic analysis",
250
- "Weather forecasting",
251
- "Smart cost estimation"
252
- ],
253
- url=AGENT_URLS["delivery"],
254
- color="#164d8c"
255
- ))
256
-
257
- with gr.Column(scale=1):
258
- gr.HTML(create_agent_card(
259
- title="SparkNova",
260
- 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.",
261
- features=[
262
- "AI-driven Query Understanding",
263
- "Smart Visualizations",
264
- "Insight Generation",
265
- "Time-Efficient Analysis",
266
- "Decision Support"
267
- ],
268
- url=AGENT_URLS["agent2"],
269
- color="#168c44"
270
- ))
271
-
272
- with gr.Column(scale=1):
273
- gr.HTML(create_agent_card(
274
- title="SparkMart AI",
275
- 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.""",
276
- features=[
277
- "Order Management",
278
- "Personalized Recommendations",
279
- "Complaint Resolution",
280
- "Conversational State",
281
- "Query Assistance"
282
- ],
283
- url=AGENT_URLS["agent3"],
284
- color="#168c44"
285
- ))
286
-
287
- gr.HTML("""
288
-
289
- <div style='
290
- margin-top: 50px;
291
- padding: 35px;
292
- background: linear-gradient(135deg, #e8f5ff 0%, #f3fff6 100%);
293
- border-radius: 18px;
294
- border-left: 6px solid #204c6c;
295
- box-shadow: 0px 8px 25px rgba(0,0,0,0.08);
296
- '>
297
-
298
- <h3 style='
299
- margin:0 0 25px 0;
300
- font-size:1.8em;
301
- font-weight:800;
302
- color:#0e1a2b;
303
- letter-spacing:0.5px;
304
- '>
305
- System Status
306
- </h3>
307
-
308
- <div style='
309
- display:flex;
310
- gap:22px;
311
- flex-wrap:wrap;
312
- '>
313
-
314
- <!-- ACTIVE AGENTS -->
315
- <div style='
316
- flex:1;
317
- min-width:230px;
318
- text-align:center;
319
- padding:25px;
320
- background:rgba(255,255,255,0.75);
321
- border-radius:16px;
322
- border:1px solid rgba(32,76,108,0.18);
323
- backdrop-filter:blur(6px);
324
- box-shadow:0 4px 14px rgba(32,76,108,0.15);
325
- transition:0.3s ease;
326
- '
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;'>3</div>
331
- <div style='color:#334155; font-size:1em; margin-top:6px;'>Active Agents</div>
332
- </div>
333
-
334
- <!-- IN DEVELOPMENT -->
335
- <div style='
336
- flex:1;
337
- min-width:230px;
338
- text-align:center;
339
- padding:25px;
340
- background:rgba(255,255,255,0.75);
341
- border-radius:16px;
342
- border:1px solid rgba(32,76,108,0.18);
343
- backdrop-filter:blur(6px);
344
- box-shadow:0 4px 14px rgba(32,76,108,0.15);
345
- transition:0.3s ease;
346
- '
347
- onmouseover="this.style.transform='translateY(-6px)'; this.style.boxShadow='0 10px 28px rgba(32,76,108,0.25)';"
348
- onmouseout="this.style.transform='translateY(0)'; this.style.boxShadow='0 4px 14px rgba(32,76,108,0.15)';"
349
- >
350
- <div style='font-size:2.4em; color:#204c6c; font-weight:700;'>0</div>
351
- <div style='color:#334155; font-size:1em; margin-top:6px;'>In Development</div>
352
- </div>
353
-
354
- <!-- TOTAL AGENTS -->
355
- <div style='
356
- flex:1;
357
- min-width:230px;
358
- text-align:center;
359
- padding:25px;
360
- background:rgba(255,255,255,0.75);
361
- border-radius:16px;
362
- border:1px solid rgba(32,76,108,0.18);
363
- backdrop-filter:blur(6px);
364
- box-shadow:0 4px 14px rgba(32,76,108,0.15);
365
- transition:0.3s ease;
366
- '
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;'>3</div>
371
- <div style='color:#334155; font-size:1em; margin-top:6px;'>Total Agents</div>
372
- </div>
373
-
374
- </div>
375
- </div>
376
-
377
-
378
- """)
379
-
380
- # -----------------------------------
381
- # HOW IT WORKS TITLE
382
- # -----------------------------------
383
- gr.HTML("""
384
- <div style='
385
- margin-top:60px;
386
- text-align:center;
387
- font-size:2.8em;
388
- font-weight:800;
389
- letter-spacing:1px;
390
- color: #ffffff;
391
- '>
392
- How It Works
393
- </div>
394
- """)
395
-
396
- with gr.Row():
397
-
398
- with gr.Column():
399
- gr.HTML("""
400
- <div style='padding:20px 40px; text-align:left; margin-left: 130px; color: white;'>
401
- <h3>Independent Agents</h3>
402
- <ul>
403
- <li>Isolated environments</li>
404
- <li>Scalable + independently upgradable</li>
405
- <li>Optimized resource allocation</li>
406
- <li>Specialized task modules</li>
407
- </ul>
408
- </div>
409
- """)
410
-
411
- with gr.Column():
412
- gr.HTML("""
413
- <div style='padding:20px 40px; text-align:left; margin-left: 130px;'>
414
- <h3>Getting Started</h3>
415
- <ul>
416
- <li>Choose your agent</li>
417
- <li>Click “Launch Agent”</li>
418
- <li>Enter your query & receive instant results</li>
419
- <li>Save or download output</li>
420
- </ul>
421
- </div>
422
- """)
423
-
424
- with gr.Column():
425
- gr.HTML("""
426
- <div style='padding:20px 40px; text-align:left; margin-left: 130px;'>
427
- <h3>Best Practices</h3>
428
- <ul>
429
- <li>Be specific with queries</li>
430
- <li>Add relevant details</li>
431
- <li>Use examples as guidance</li>
432
- <li>Use agent-specific features</li>
433
- </ul>
434
- </div>
435
- """)
436
-
437
-
438
- # FOOTER --------------------------------------------------------------
439
- # gr.HTML("""
440
- # <div style='
441
- # text-align:center;
442
- # padding:30px;
443
- # margin-top:60px;
444
- # background:#f0fdf4;
445
- # border-radius:15px;
446
- # border:2px solid #dcfce7;
447
- # '>
448
- # <h3 style='margin-bottom:10px;'>Built with Modern AI Stack</h3>
449
- # <p>DeepAgents • LangChain • Groq • OpenStreetMap • Gradio</p>
450
- # <p style='font-size:0.85em; color:#6b7280; margin-top:10px;'>
451
- # HuggingFace Spaces | Open Source Architecture
452
- # </p>
453
- # </div>
454
- # """)
455
-
456
- if __name__ == "__main__":
457
- demo.launch(share=True)
458
-