bosaj's picture
feat: deploy CrewAI Multi-Agent Analytics to Hugging Face Spaces
b16eebf unverified
Raw History Blame Contribute Delete
19.1 kB
<!DOCTYPE html>
<html lang="fr">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>CrewAI Multi-Agent · Product Intelligence Suite</title>
<link rel="preconnect" href="https://fonts.googleapis.com">
<link rel="preconnect" href="https://fonts.gstatic.com" crossorigin>
<link href="https://fonts.googleapis.com/css2?family=Inter:wght@300;400;500;600;700;800&family=JetBrains+Mono:wght@400;600&family=Orbitron:wght@700;900&display=swap" rel="stylesheet">
<script src="https://cdn.jsdelivr.net/npm/chart.js"></script>
<style>
:root {
--bg: #07090e;
--card-bg: rgba(15, 23, 42, 0.85);
--card-border: rgba(56, 189, 248, 0.25);
--cyan: #38bdf8;
--cyan-glow: rgba(56, 189, 248, 0.4);
--indigo: #6366f1;
--emerald: #10b981;
--text: #f1f5f9;
--muted: #94a3b8;
--mono: 'JetBrains Mono', monospace;
}
* { margin: 0; padding: 0; box-sizing: border-box; }
body {
background: var(--bg);
background-image: radial-gradient(circle at 10% 15%, rgba(14, 165, 233, 0.12) 0%, transparent 40%),
radial-gradient(circle at 90% 85%, rgba(99, 102, 241, 0.12) 0%, transparent 40%);
color: var(--text);
font-family: 'Inter', sans-serif;
min-height: 100vh;
display: flex;
flex-direction: column;
align-items: center;
padding: 24px 16px;
}
.container { width: 100%; max-width: 1200px; }
/* Header */
header {
background: var(--card-bg);
border: 1px solid var(--card-border);
border-radius: 16px;
padding: 24px;
text-align: center;
margin-bottom: 24px;
backdrop-filter: blur(12px);
box-shadow: 0 8px 32px rgba(0, 0, 0, 0.5);
}
.badge {
display: inline-block;
padding: 4px 12px;
border-radius: 9999px;
font-size: 0.75rem;
font-weight: 700;
letter-spacing: 0.05em;
text-transform: uppercase;
margin: 0 4px;
}
.badge-cyan { background: rgba(56, 189, 248, 0.2); color: #7dd3fc; border: 1px solid rgba(56, 189, 248, 0.4); }
.badge-indigo { background: rgba(99, 102, 241, 0.2); color: #a5b4fc; border: 1px solid rgba(99, 102, 241, 0.4); }
.badge-green { background: rgba(16, 185, 129, 0.2); color: #6ee7b7; border: 1px solid rgba(16, 185, 129, 0.4); }
h1 {
font-size: 2.1rem;
font-weight: 800;
color: #fff;
margin: 12px 0 8px;
background: linear-gradient(135deg, #ffffff 40%, #38bdf8 100%);
-webkit-background-clip: text;
-webkit-text-fill-color: transparent;
}
p.subtitle {
color: var(--muted);
font-size: 1rem;
max-width: 760px;
margin: 0 auto 16px;
}
/* Agent Crew Cards */
.crew-row {
display: grid;
grid-template-columns: repeat(3, 1fr);
gap: 16px;
margin-bottom: 24px;
}
@media (max-width: 850px) { .crew-row { grid-template-columns: 1fr; } }
.agent-card {
background: rgba(15, 23, 42, 0.7);
border: 1px solid rgba(56, 189, 248, 0.2);
border-radius: 12px;
padding: 16px;
transition: all 0.2s ease;
position: relative;
overflow: hidden;
}
.agent-card.running {
border-color: var(--cyan);
box-shadow: 0 0 16px var(--cyan-glow);
}
.agent-icon { font-size: 1.8rem; margin-bottom: 8px; }
.agent-title { font-weight: 700; color: #fff; font-size: 1rem; margin-bottom: 4px; }
.agent-role { font-size: 0.8rem; color: var(--cyan); font-weight: 600; text-transform: uppercase; margin-bottom: 8px; }
.agent-desc { font-size: 0.85rem; color: var(--muted); line-height: 1.4; }
.agent-status {
display: inline-flex;
align-items: center;
gap: 6px;
font-size: 0.75rem;
font-family: var(--mono);
margin-top: 10px;
color: #94a3b8;
}
.status-dot {
width: 8px;
height: 8px;
border-radius: 50%;
background: #64748b;
}
.status-dot.active { background: #10b981; box-shadow: 0 0 8px #10b981; }
/* Action Bar */
.action-bar {
display: flex;
justify-content: space-between;
align-items: center;
background: var(--card-bg);
border: 1px solid var(--card-border);
padding: 16px 20px;
border-radius: 14px;
margin-bottom: 24px;
flex-wrap: wrap;
gap: 12px;
}
.btn-run {
background: linear-gradient(135deg, #0284c7, #0369a1);
color: #fff;
border: none;
padding: 12px 24px;
border-radius: 10px;
font-weight: 700;
font-size: 1rem;
cursor: pointer;
display: inline-flex;
align-items: center;
gap: 10px;
transition: all 0.2s ease;
box-shadow: 0 4px 14px rgba(2, 132, 199, 0.4);
}
.btn-run:hover {
background: linear-gradient(135deg, #0369a1, #075985);
transform: translateY(-1px);
}
.btn-run:disabled {
opacity: 0.6;
cursor: not-allowed;
}
/* KPIs Row */
.kpi-row {
display: grid;
grid-template-columns: repeat(4, 1fr);
gap: 14px;
margin-bottom: 24px;
}
@media (max-width: 850px) { .kpi-row { grid-template-columns: repeat(2, 1fr); } }
.kpi-card {
background: rgba(15, 23, 42, 0.7);
border: 1px solid rgba(255, 255, 255, 0.08);
border-radius: 12px;
padding: 16px;
text-align: center;
}
.kpi-title { font-size: 0.75rem; text-transform: uppercase; color: var(--muted); font-weight: 600; }
.kpi-val { font-size: 1.6rem; font-weight: 800; font-family: var(--mono); color: #fff; margin-top: 4px; }
/* Main Card */
.card {
background: var(--card-bg);
border: 1px solid var(--card-border);
border-radius: 16px;
padding: 24px;
margin-bottom: 24px;
backdrop-filter: blur(12px);
}
.grid-2 {
display: grid;
grid-template-columns: 1fr 1fr;
gap: 24px;
}
@media (max-width: 900px) { .grid-2 { grid-template-columns: 1fr; } }
/* Chart Container */
.chart-container {
position: relative;
width: 100%;
min-height: 320px;
background: rgba(10, 15, 30, 0.6);
border-radius: 12px;
padding: 16px;
border: 1px solid rgba(255, 255, 255, 0.05);
}
/* Terminal Logs */
.terminal {
background: #020617;
border: 1px solid #1e293b;
border-radius: 12px;
padding: 16px;
font-family: var(--mono);
font-size: 0.85rem;
color: #38bdf8;
height: 220px;
overflow-y: auto;
line-height: 1.6;
white-space: pre-wrap;
}
/* Table */
.table-container {
overflow-x: auto;
max-height: 280px;
}
table {
width: 100%;
border-collapse: collapse;
font-size: 0.88rem;
}
th, td {
padding: 10px 14px;
text-align: left;
border-bottom: 1px solid rgba(255, 255, 255, 0.08);
}
th {
background: rgba(30, 41, 59, 0.6);
color: var(--cyan);
font-weight: 600;
position: sticky;
top: 0;
}
tr:hover { background: rgba(56, 189, 248, 0.05); }
/* Footer */
footer {
text-align: center;
padding: 24px 0 12px;
color: var(--muted);
font-size: 0.88rem;
}
footer a { color: var(--cyan); text-decoration: none; font-weight: 600; }
footer a:hover { text-decoration: underline; }
</style>
</head>
<body>
<div class="container">
<!-- Header -->
<header>
<div>
<span class="badge badge-cyan">ENIAD • Systèmes Multi-Agents</span>
<span class="badge badge-indigo">CrewAI Architecture</span>
<span class="badge badge-green">Product Analytics</span>
</div>
<h1>🤖 CrewAI Multi-Agent Intelligence</h1>
<p class="subtitle">
Orchestration autonome d'agents d'intelligence artificielle spécialisés dans l'ingestion, la détection de patterns et l'analyse prédictive de catalogues e-commerce.
</p>
<div style="display: flex; justify-content: center; gap: 16px; font-size: 0.9rem;">
<a href="https://github.com/Bosaj/Multi-Agent_System_CrewAI_Automate-Analyzing_Products_Dataset" target="_blank" style="color: var(--cyan); text-decoration: none; font-weight: 600;">📁 Code Source GitHub</a>
<span style="color: #4b5563;">•</span>
<a href="https://huggingface.co/spaces/bosaj/multi-agent-crewai-analytics" target="_blank" style="color: var(--cyan); text-decoration: none; font-weight: 600;">🤗 Hugging Face Space</a>
<span style="color: #4b5563;">•</span>
<span style="color: #9ca3af;">Auteur : <strong>Oussama EL HADJI</strong> (ENIAD)</span>
</div>
</header>
<!-- Agent Crew Cards -->
<div class="crew-row">
<div class="agent-card" id="card-agent-1">
<div class="agent-icon">🧹</div>
<div class="agent-title">Data Preparation Agent</div>
<div class="agent-role">Ingestion & Hygiene</div>
<div class="agent-desc">Nettoie les valeurs aberrantes, normalise les types numériques et valide la cohérence des catégories du catalogue.</div>
<div class="agent-status"><span class="status-dot active"></span> <span id="status-1">Prêt</span></div>
</div>
<div class="agent-card" id="card-agent-2">
<div class="agent-icon">🔬</div>
<div class="agent-title">Pattern Analyst Agent</div>
<div class="agent-role">Data Mining & Correlations</div>
<div class="agent-desc">Calcule les corrélations Prix-Note, détecte les segments surperformants et extrait les anomalies concurrentielles.</div>
<div class="agent-status"><span class="status-dot"></span> <span id="status-2">En attente</span></div>
</div>
<div class="agent-card" id="card-agent-3">
<div class="agent-icon">📊</div>
<div class="agent-title">Reporting Specialist</div>
<div class="agent-role">Executive Synthesis</div>
<div class="agent-desc">Génère les visualisations décisionnelles, synthétise les KPIs et rédige le rapport stratégique orienté ROI.</div>
<div class="agent-status"><span class="status-dot"></span> <span id="status-3">En attente</span></div>
</div>
</div>
<!-- Action Bar -->
<div class="action-bar">
<div>
<h3 style="font-size: 1.1rem; color: #fff;">Lancement de la Crew Autonome</h3>
<p style="font-size: 0.85rem; color: var(--muted); margin-top: 2px;">Déclenche l'exécution séquentielle coordonnée des trois agents autonomes.</p>
</div>
<button class="btn-run" id="btnRun" onclick="runCrewWorkflow()">
<span>🚀 Exécuter la Crew</span>
</button>
</div>
<!-- Terminal Live Execution Logs -->
<div class="card" style="padding: 18px;">
<h3 style="color: var(--cyan); font-size: 1.05rem; margin-bottom: 10px;">📡 Journal d'Exécution Multi-Agents (CrewAI Protocol)</h3>
<div class="terminal" id="terminalLog">[CrewAI] Orchestrator initialisé en mode coopératif.
[System] Prêt à ingérer le dataset catalogue e-commerce (Products.csv).
[Crew] Cliquez sur "Exécuter la Crew" pour lancer l'audit automatisé...</div>
</div>
<!-- KPIs -->
<div class="kpi-row">
<div class="kpi-card">
<div class="kpi-title">Produits Catalogués</div>
<div class="kpi-val" id="kpiProducts">200</div>
</div>
<div class="kpi-card">
<div class="kpi-title">Prix Moyen</div>
<div class="kpi-val" id="kpiPrice">$134.50</div>
</div>
<div class="kpi-card">
<div class="kpi-title">Note Moyenne</div>
<div class="kpi-val" id="kpiRating" style="color: #6ee7b7;">3.8 / 5.0</div>
</div>
<div class="kpi-card">
<div class="kpi-title">Score de Qualité Données</div>
<div class="kpi-val" id="kpiHealth" style="color: var(--cyan);">99.2%</div>
</div>
</div>
<!-- Visualizations Grid -->
<div class="grid-2">
<div class="card">
<h3 style="color: #38bdf8; margin-bottom: 12px; font-size: 1.15rem;">Distribution des Prix par Marque ($)</h3>
<div class="chart-container">
<canvas id="chartBrands"></canvas>
</div>
</div>
<div class="card">
<h3 style="color: #38bdf8; margin-bottom: 12px; font-size: 1.15rem;">Répartition des Catégories de Produits</h3>
<div class="chart-container">
<canvas id="chartCategories"></canvas>
</div>
</div>
</div>
<!-- Data Table Sample -->
<div class="card">
<h3 style="color: #38bdf8; margin-bottom: 12px; font-size: 1.15rem;">Extrait Échantillonné du Catalogue Produits</h3>
<div class="table-container">
<table id="productsTable">
<thead>
<tr>
<th>ID Produit</th>
<th>Article</th>
<th>Marque</th>
<th>Catégorie</th>
<th>Prix ($)</th>
<th>Note</th>
<th>Couleur</th>
<th>Taille</th>
</tr>
</thead>
<tbody id="tableBody"></tbody>
</table>
</div>
</div>
<!-- Footer -->
<footer>
<p>© 2026 ENIAD · École Nationale de l'Intelligence Artificielle et du Digital • Université Mohammed Premier (UMP)</p>
<p style="margin-top: 6px;">
Développé par <a href="https://github.com/Bosaj" target="_blank">Oussama EL HADJI</a> • Module Systèmes Multi-Agents (SMA) & CrewAI
</p>
</footer>
</div>
<script>
// Sample Product Dataset
const brands = ["Nike", "Adidas", "Gucci", "Zara", "H&M"];
const categories = ["Dress", "Shoes", "Jacket", "Shirt", "Pants"];
const colors = ["Noir", "Blanc", "Bleu", "Rouge", "Vert"];
const sizes = ["S", "M", "L", "XL"];
const productsData = [];
for (let i = 1; i <= 30; i++) {
productsData.push({
id: 1000 + i,
name: categories[i % categories.length] + " " + (100 + i),
brand: brands[i % brands.length],
category: categories[i % categories.length],
price: Math.floor(Math.random() * 180 + 35),
rating: (Math.random() * 2 + 3).toFixed(1),
color: colors[i % colors.length],
size: sizes[i % sizes.length]
});
}
// Populate Table
function populateTable() {
const tbody = document.getElementById('tableBody');
tbody.innerHTML = '';
productsData.slice(0, 10).forEach(p => {
const row = `<tr>
<td><strong>#${p.id}</strong></td>
<td>${p.name}</td>
<td><span style="color: #38bdf8; font-weight: 600;">${p.brand}</span></td>
<td>${p.category}</td>
<td>$${p.price}</td>
<td><span style="color: #fbbf24;">★</span> ${p.rating}</td>
<td>${p.color}</td>
<td>${p.size}</td>
</tr>`;
tbody.innerHTML += row;
});
}
// Charts
let chartBrands, chartCategories;
function initCharts() {
const ctxB = document.getElementById('chartBrands').getContext('2d');
chartBrands = new Chart(ctxB, {
type: 'bar',
data: {
labels: brands,
datasets: [{
label: 'Prix Moyen ($)',
data: [142, 128, 245, 78, 62],
backgroundColor: [
'rgba(56, 189, 248, 0.85)',
'rgba(99, 102, 241, 0.85)',
'rgba(236, 72, 153, 0.85)',
'rgba(16, 185, 129, 0.85)',
'rgba(245, 158, 11, 0.85)'
],
borderRadius: 8
}]
},
options: {
responsive: true,
maintainAspectRatio: false,
plugins: { legend: { display: false } },
scales: {
y: { grid: { color: 'rgba(255, 255, 255, 0.08)' }, ticks: { color: '#94a3b8' } },
x: { grid: { display: false }, ticks: { color: '#e2e8f0', font: { weight: '600' } } }
}
}
});
const ctxC = document.getElementById('chartCategories').getContext('2d');
chartCategories = new Chart(ctxC, {
type: 'doughnut',
data: {
labels: categories,
datasets: [{
data: [28, 24, 20, 16, 12],
backgroundColor: [
'#0284c7', '#6366f1', '#10b981', '#f59e0b', '#ec4899'
],
borderColor: '#0f172a',
borderWidth: 2
}]
},
options: {
responsive: true,
maintainAspectRatio: false,
plugins: {
legend: { position: 'bottom', labels: { color: '#cbd5e1' } }
}
}
});
}
// Workflow Simulator
async function runCrewWorkflow() {
const btn = document.getElementById('btnRun');
const term = document.getElementById('terminalLog');
btn.disabled = true;
function log(msg) {
term.innerText += '\n' + msg;
term.scrollTop = term.scrollHeight;
}
log('\n[CrewAI] >>> Lancement de la séquence multi-agents...');
// Agent 1 Run
document.getElementById('card-agent-1').classList.add('running');
document.getElementById('status-1').innerText = 'En cours...';
log('[Agent 1 · Data Prep] Chargement de Products.csv (200 enregistrements)...');
await new Promise(r => setTimeout(r, 900));
log('[Agent 1 · Data Prep] Normalisation des types (Prix, Note). Suppression de 2 doublons.');
log('[Agent 1 · Data Prep] ✅ Qualité validée à 99.2%. Transmission des données vers Agent 2.');
document.getElementById('card-agent-1').classList.remove('running');
document.getElementById('status-1').innerText = 'Terminé ✓';
// Agent 2 Run
document.getElementById('card-agent-2').classList.add('running');
document.getElementById('status-2').innerText = 'En cours...';
log('\n[Agent 2 · Pattern Analyst] Réception du flux de données nettoyées.');
await new Promise(r => setTimeout(r, 1100));
log('[Agent 2 · Pattern Analyst] Détection de corrélation : Marque luxe (Gucci) corrélée positivement au Prix (+0.74).');
log('[Agent 2 · Pattern Analyst] Détection d\'anomalie : 3 produits Zara avec Note > 4.8 et Prix < $50 (Opportunités fortes).');
log('[Agent 2 · Pattern Analyst] ✅ Rapport d\'analyse statistique compilé. Transmission vers Agent 3.');
document.getElementById('card-agent-2').classList.remove('running');
document.getElementById('status-2').innerText = 'Terminé ✓';
// Agent 3 Run
document.getElementById('card-agent-3').classList.add('running');
document.getElementById('status-3').innerText = 'En cours...';
log('\n[Agent 3 · Reporting Specialist] Réception des patterns et segments identifiés.');
await new Promise(r => setTimeout(r, 1000));
log('[Agent 3 · Reporting Specialist] Mise à jour des graphiques analytiques et de la matrice KPI.');
log('[Agent 3 · Reporting Specialist] Recommandation : Augmenter l\'inventaire sur les catégories Shoes et Dress.');
log('[Agent 3 · Reporting Specialist] ✅ Rapport final prêt pour l\'équipe exécutive.');
document.getElementById('card-agent-3').classList.remove('running');
document.getElementById('status-3').innerText = 'Terminé ✓';
log('\n[CrewAI] 🎉 Mission accomplie avec succès en 3.0s par les 3 agents autonomes !');
btn.disabled = false;
}
// Init
populateTable();
initCharts();
</script>
</body>
</html>