Spaces:
Sleeping
Sleeping
Upload 3 files
Browse files- README.md +56 -0
- app.py +265 -0
- requirements.txt +2 -0
README.md
ADDED
|
@@ -0,0 +1,56 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
---
|
| 2 |
+
title: Multi-Agent System Hub
|
| 3 |
+
colorFrom: blue
|
| 4 |
+
colorTo: purple
|
| 5 |
+
sdk: gradio
|
| 6 |
+
sdk_version: 5.49.1
|
| 7 |
+
app_file: app.py
|
| 8 |
+
pinned: true
|
| 9 |
+
license: mit
|
| 10 |
+
python_version: 3.11
|
| 11 |
+
---
|
| 12 |
+
|
| 13 |
+
# Multi-Agent System Hub
|
| 14 |
+
|
| 15 |
+
Central hub for accessing specialized AI agents. Each agent is independently deployed and optimized for specific tasks.
|
| 16 |
+
|
| 17 |
+
## Available Agents
|
| 18 |
+
|
| 19 |
+
### 1. Delivery Optimization Agent (Active)
|
| 20 |
+
Real-time route planning and optimization using OpenStreetMap
|
| 21 |
+
- Interactive maps with turn-by-turn directions
|
| 22 |
+
- Cost optimization for deliveries
|
| 23 |
+
- Traffic analysis
|
| 24 |
+
- Multiple route comparison
|
| 25 |
+
|
| 26 |
+
### 2. Agent 2 (Coming Soon)
|
| 27 |
+
Details to be announced
|
| 28 |
+
|
| 29 |
+
### 3. Agent 3 (Coming Soon)
|
| 30 |
+
Details to be announced
|
| 31 |
+
|
| 32 |
+
## How to Use
|
| 33 |
+
|
| 34 |
+
1. Click on any active agent card
|
| 35 |
+
2. You'll be redirected to the agent's dedicated interface
|
| 36 |
+
3. Enter your query and get AI-powered results
|
| 37 |
+
|
| 38 |
+
## Architecture
|
| 39 |
+
|
| 40 |
+
This hub uses a microservices architecture where:
|
| 41 |
+
- Each agent runs in its own Hugging Face Space
|
| 42 |
+
- Agents are independently deployable and scalable
|
| 43 |
+
- Hub provides unified access point
|
| 44 |
+
- No cross-dependencies between agents
|
| 45 |
+
|
| 46 |
+
## For Developers
|
| 47 |
+
|
| 48 |
+
To add a new agent:
|
| 49 |
+
1. Deploy your agent as a separate HF Space
|
| 50 |
+
2. Update `AGENT_URLS` in `app.py` with your Space URL
|
| 51 |
+
3. Update agent details (title, description, features)
|
| 52 |
+
4. Commit changes
|
| 53 |
+
|
| 54 |
+
---
|
| 55 |
+
|
| 56 |
+
Built with Gradio | Deployed on Hugging Face Spaces
|
app.py
ADDED
|
@@ -0,0 +1,265 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|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
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
import gradio as gr
|
| 2 |
+
|
| 3 |
+
AGENT_URLS = {
|
| 4 |
+
"delivery": "https://huggingface.co/spaces/shuv25/optimize_delivery_system",
|
| 5 |
+
"agent2": "https://huggingface.co/spaces/Tamannathakur/Data_Analyzer",
|
| 6 |
+
"agent3": "https://huggingface.co/spaces/akankshar639/CustomerSupportAgent"
|
| 7 |
+
}
|
| 8 |
+
|
| 9 |
+
def create_agent_card(title, description, features, url, color, status="active"):
|
| 10 |
+
"""Create a card for each agent"""
|
| 11 |
+
|
| 12 |
+
if status == "active":
|
| 13 |
+
status_badge = "<span style='background:#10b981; color:white; padding:4px 12px; border-radius:12px; font-size:0.85em; font-weight:600;'>ACTIVE</span>"
|
| 14 |
+
else:
|
| 15 |
+
status_badge = "<span style='background:#6b7280; color:white; padding:4px 12px; border-radius:12px; font-size:0.85em; font-weight:600;'>COMING SOON</span>"
|
| 16 |
+
|
| 17 |
+
features_html = "".join([f"<li style='margin:8px 0; color:#4b5563;'>{feature}</li>" for feature in features])
|
| 18 |
+
|
| 19 |
+
if status == "active":
|
| 20 |
+
button = f"""
|
| 21 |
+
<a href="{url}" target="_blank" class="launch-btn" style='
|
| 22 |
+
display: block;
|
| 23 |
+
text-align: center;
|
| 24 |
+
padding: 14px;
|
| 25 |
+
background: linear-gradient(135deg, #f97316, #ea580c);
|
| 26 |
+
color: white;
|
| 27 |
+
text-decoration: none;
|
| 28 |
+
border-radius: 10px;
|
| 29 |
+
font-weight: 600;
|
| 30 |
+
font-size: 1em;
|
| 31 |
+
margin-top: 20px;
|
| 32 |
+
transition: all 0.25s ease;
|
| 33 |
+
' onmouseover="this.style.background='linear-gradient(135deg, #fb923c, #f59e0b)'; this.style.transform='scale(1.03)'"
|
| 34 |
+
onmouseout="this.style.background='linear-gradient(135deg, #f97316, #ea580c)'; this.style.transform='scale(1)'">
|
| 35 |
+
🚀 Launch Agent
|
| 36 |
+
</a>
|
| 37 |
+
"""
|
| 38 |
+
else:
|
| 39 |
+
button = f"""
|
| 40 |
+
<div style='
|
| 41 |
+
text-align: center;
|
| 42 |
+
padding: 14px;
|
| 43 |
+
background: #e5e7eb;
|
| 44 |
+
color: #6b7280;
|
| 45 |
+
border-radius: 10px;
|
| 46 |
+
font-weight: 600;
|
| 47 |
+
font-size: 1em;
|
| 48 |
+
margin-top: 20px;
|
| 49 |
+
cursor: not-allowed;
|
| 50 |
+
'>
|
| 51 |
+
Coming Soon
|
| 52 |
+
</div>
|
| 53 |
+
"""
|
| 54 |
+
|
| 55 |
+
card_html = f"""
|
| 56 |
+
<div style='
|
| 57 |
+
border-radius: 16px;
|
| 58 |
+
padding: 28px;
|
| 59 |
+
background: white;
|
| 60 |
+
box-shadow: 0 4px 6px rgba(0,0,0,0.1);
|
| 61 |
+
height: 100%;
|
| 62 |
+
border-top: 4px solid {color};
|
| 63 |
+
'>
|
| 64 |
+
<div style='display:flex; justify-content:space-between; align-items:center; margin-bottom:16px;'>
|
| 65 |
+
<h2 style='margin:0; color:#1f2937; font-size:1.5em;'>{title}</h2>
|
| 66 |
+
{status_badge}
|
| 67 |
+
</div>
|
| 68 |
+
|
| 69 |
+
<p style='color:#6b7280; margin:12px 0 20px 0; line-height:1.6; font-size:0.95em;'>
|
| 70 |
+
{description}
|
| 71 |
+
</p>
|
| 72 |
+
|
| 73 |
+
<div style='background:#f9fafb; padding:16px; border-radius:10px; margin:16px 0;'>
|
| 74 |
+
<h4 style='margin:0 0 12px 0; color:#374151; font-size:0.9em; font-weight:600;'>KEY FEATURES:</h4>
|
| 75 |
+
<ul style='margin:0; padding-left:20px;'>
|
| 76 |
+
{features_html}
|
| 77 |
+
</ul>
|
| 78 |
+
</div>
|
| 79 |
+
|
| 80 |
+
{button}
|
| 81 |
+
</div>
|
| 82 |
+
"""
|
| 83 |
+
|
| 84 |
+
return card_html
|
| 85 |
+
|
| 86 |
+
|
| 87 |
+
with gr.Blocks(
|
| 88 |
+
theme=gr.themes.Soft(primary_hue="orange", secondary_hue="amber"),
|
| 89 |
+
title="Multi-Agent System Hub",
|
| 90 |
+
css="""
|
| 91 |
+
body, html {
|
| 92 |
+
margin: 0;
|
| 93 |
+
padding: 0;
|
| 94 |
+
width: 100%;
|
| 95 |
+
overflow-x: hidden;
|
| 96 |
+
}
|
| 97 |
+
.gradio-container {
|
| 98 |
+
max-width: 100% !important;
|
| 99 |
+
width: 100% !important;
|
| 100 |
+
padding: 0 !important;
|
| 101 |
+
margin: 0 auto !important;
|
| 102 |
+
}
|
| 103 |
+
.block {
|
| 104 |
+
width: 100% !important;
|
| 105 |
+
}
|
| 106 |
+
#root > div {
|
| 107 |
+
width: 100% !important;
|
| 108 |
+
}
|
| 109 |
+
"""
|
| 110 |
+
) as demo:
|
| 111 |
+
|
| 112 |
+
gr.HTML("""
|
| 113 |
+
<div style='
|
| 114 |
+
text-align: center;
|
| 115 |
+
padding: 50px 20px;
|
| 116 |
+
background: linear-gradient(135deg, #f97316 0%, #f59e0b 100%);
|
| 117 |
+
border-radius: 20px;
|
| 118 |
+
color: white;
|
| 119 |
+
margin-bottom: 40px;
|
| 120 |
+
box-shadow: 0 20px 25px -5px rgba(0,0,0,0.1);
|
| 121 |
+
'>
|
| 122 |
+
<h1 style='margin: 0; font-size: 3em; font-weight: 800; text-shadow: 2px 2px 4px rgba(0,0,0,0.2);'>
|
| 123 |
+
Multi-Agent System Hub
|
| 124 |
+
</h1>
|
| 125 |
+
<p style='margin: 20px 0 0 0; font-size: 1.4em; opacity: 0.95; font-weight: 300;'>
|
| 126 |
+
Specialized AI Agents for Different Tasks
|
| 127 |
+
</p>
|
| 128 |
+
<p style='margin: 12px 0 0 0; font-size: 1em; opacity: 0.85;'>
|
| 129 |
+
Choose an agent based on your specific needs
|
| 130 |
+
</p>
|
| 131 |
+
</div>
|
| 132 |
+
""")
|
| 133 |
+
|
| 134 |
+
gr.Markdown("## Available Agents")
|
| 135 |
+
|
| 136 |
+
with gr.Row():
|
| 137 |
+
with gr.Column():
|
| 138 |
+
gr.HTML(create_agent_card(
|
| 139 |
+
title="Delivery Optimization Agent",
|
| 140 |
+
description="Real-time route planning, cost optimization, and traffic analysis using OpenStreetMap data. Get optimized delivery routes with accurate cost estimates.",
|
| 141 |
+
features=[
|
| 142 |
+
"Interactive maps with turn-by-turn directions",
|
| 143 |
+
"Real-world cost estimation and vehicle optimization",
|
| 144 |
+
"Live traffic analysis and departure time suggestions",
|
| 145 |
+
"Multiple route comparison and selection"
|
| 146 |
+
],
|
| 147 |
+
url=AGENT_URLS["delivery"],
|
| 148 |
+
color="linear-gradient(135deg, #f97316, #ea580c)",
|
| 149 |
+
status="active"
|
| 150 |
+
))
|
| 151 |
+
|
| 152 |
+
with gr.Column():
|
| 153 |
+
gr.HTML(create_agent_card(
|
| 154 |
+
title="Data Analyzer Agent",
|
| 155 |
+
description="""Data Analyzer is an AI-powered data analysis tool that automatically explore, visualize,
|
| 156 |
+
and generate insights from uploaded CSV datasets through natural language queries""",
|
| 157 |
+
features=[
|
| 158 |
+
"AI-driven Query Understanding ",
|
| 159 |
+
"Smart Visualizations ",
|
| 160 |
+
"Insight Generation",
|
| 161 |
+
"Time-Efficient Analysis"
|
| 162 |
+
"Decision-Making Support"
|
| 163 |
+
],
|
| 164 |
+
url=AGENT_URLS["agent2"],
|
| 165 |
+
color="linear-gradient(135deg, #6366f1, #8b5cf6)",
|
| 166 |
+
status="active"
|
| 167 |
+
))
|
| 168 |
+
|
| 169 |
+
with gr.Column():
|
| 170 |
+
gr.HTML(create_agent_card(
|
| 171 |
+
title="SparkMart AI",
|
| 172 |
+
description="""SparkMart AI, a chatbot e-commerce customer service by automating order tracking, resolving complaints,
|
| 173 |
+
and offering personalized product recommendations or specific product recommendation.""",
|
| 174 |
+
features=[
|
| 175 |
+
"Intelligent Order Management",
|
| 176 |
+
"Personalized Product Recommendations ",
|
| 177 |
+
"Multi-Stage Complaint Resolution",
|
| 178 |
+
"Conversational State Management",
|
| 179 |
+
"General Query Assistance"
|
| 180 |
+
],
|
| 181 |
+
url=AGENT_URLS["agent3"],
|
| 182 |
+
color="linear-gradient(135deg, #4facfe, #00f2fe)",
|
| 183 |
+
status="active"
|
| 184 |
+
))
|
| 185 |
+
|
| 186 |
+
gr.Markdown("---")
|
| 187 |
+
gr.Markdown("## How It Works")
|
| 188 |
+
|
| 189 |
+
with gr.Row():
|
| 190 |
+
with gr.Column():
|
| 191 |
+
gr.Markdown("""
|
| 192 |
+
### Independent Agents
|
| 193 |
+
Each agent runs in its own environment:
|
| 194 |
+
- **Isolated**: Problems in one don't affect others
|
| 195 |
+
- **Scalable**: Each can be updated independently
|
| 196 |
+
- **Optimized**: Resources allocated per agent needs
|
| 197 |
+
- **Specialized**: Focused on specific tasks
|
| 198 |
+
""")
|
| 199 |
+
|
| 200 |
+
with gr.Column():
|
| 201 |
+
gr.Markdown("""
|
| 202 |
+
### Getting Started
|
| 203 |
+
1. **Choose** your agent based on your task
|
| 204 |
+
2. **Click** "Launch Agent" button
|
| 205 |
+
3. **Enter** your query in the agent interface
|
| 206 |
+
4. **Get** instant AI-powered results
|
| 207 |
+
5. **Download** or save your results
|
| 208 |
+
""")
|
| 209 |
+
|
| 210 |
+
with gr.Column():
|
| 211 |
+
gr.Markdown("""
|
| 212 |
+
### Best Practices
|
| 213 |
+
- Be specific with your queries
|
| 214 |
+
- Include all relevant details
|
| 215 |
+
- Check example queries for guidance
|
| 216 |
+
- Use agent-specific features
|
| 217 |
+
- Save important results immediately
|
| 218 |
+
""")
|
| 219 |
+
|
| 220 |
+
gr.HTML("""
|
| 221 |
+
<div style='
|
| 222 |
+
margin-top: 40px;
|
| 223 |
+
padding: 30px;
|
| 224 |
+
background: #fff7ed;
|
| 225 |
+
border-radius: 15px;
|
| 226 |
+
border-left: 5px solid #f97316;
|
| 227 |
+
'>
|
| 228 |
+
<h3 style='margin: 0 0 15px 0; color:#1f2937;'>System Status</h3>
|
| 229 |
+
<div style='display:grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); gap:20px;'>
|
| 230 |
+
<div style='text-align:center; padding:15px; background:white; border-radius:10px;'>
|
| 231 |
+
<div style='font-size:2em; color:#10b981; margin-bottom:8px;'>1</div>
|
| 232 |
+
<div style='color:#6b7280; font-size:0.9em;'>Active Agents</div>
|
| 233 |
+
</div>
|
| 234 |
+
<div style='text-align:center; padding:15px; background:white; border-radius:10px;'>
|
| 235 |
+
<div style='font-size:2em; color:#f59e0b; margin-bottom:8px;'>2</div>
|
| 236 |
+
<div style='color:#6b7280; font-size:0.9em;'>In Development</div>
|
| 237 |
+
</div>
|
| 238 |
+
<div style='text-align:center; padding:15px; background:white; border-radius:10px;'>
|
| 239 |
+
<div style='font-size:2em; color:#3b82f6; margin-bottom:8px;'>3</div>
|
| 240 |
+
<div style='color:#6b7280; font-size:0.9em;'>Total Agents</div>
|
| 241 |
+
</div>
|
| 242 |
+
</div>
|
| 243 |
+
</div>
|
| 244 |
+
""")
|
| 245 |
+
|
| 246 |
+
gr.HTML("""
|
| 247 |
+
<div style='
|
| 248 |
+
text-align: center;
|
| 249 |
+
padding: 30px;
|
| 250 |
+
margin-top: 50px;
|
| 251 |
+
background: #fff7ed;
|
| 252 |
+
border-radius: 15px;
|
| 253 |
+
'>
|
| 254 |
+
<h3 style='margin: 0 0 15px 0; color:#1f2937;'>Built with Modern AI Stack</h3>
|
| 255 |
+
<p style='margin: 0; color: #6b7280; font-size:0.95em;'>
|
| 256 |
+
DeepAgents | LangChain | Groq | OpenStreetMap | Gradio
|
| 257 |
+
</p>
|
| 258 |
+
<p style='margin: 15px 0 0 0; font-size: 0.85em; color: #9ca3af;'>
|
| 259 |
+
Deployed on Hugging Face Spaces | Open Source Architecture
|
| 260 |
+
</p>
|
| 261 |
+
</div>
|
| 262 |
+
""")
|
| 263 |
+
|
| 264 |
+
if __name__ == "__main__":
|
| 265 |
+
demo.launch()
|
requirements.txt
ADDED
|
@@ -0,0 +1,2 @@
|
|
|
|
|
|
|
|
|
|
| 1 |
+
|
| 2 |
+
gradio
|