// src/components/ContributionChart.jsx // Horizontal bar chart showing per-modality contribution to the final decision import { useEffect, useState } from 'react'; const MODALITIES = [ { key: 'visual', label: 'Visual', icon: '👁️', color: '#7c3aed', bg: 'linear-gradient(90deg, #7c3aed, #9d6ff7)', }, { key: 'audio', label: 'Audio', icon: '🎙️', color: '#06b6d4', bg: 'linear-gradient(90deg, #06b6d4, #22d3ee)', }, { key: 'lipsync', label: 'Lip-Sync', icon: '👄', color: '#f43f5e', bg: 'linear-gradient(90deg, #f43f5e, #fb7185)', }, ]; export default function ContributionChart({ contributions }) { const [animated, setAnimated] = useState(false); useEffect(() => { const t = setTimeout(() => setAnimated(true), 200); return () => clearTimeout(t); }, []); return (

Modality Contributions

{MODALITIES.map((m, i) => { const value = contributions[m.key] ?? 0; const pct = Math.round(value * 100); return (
{/* Label */}
{' '} {m.label}
{/* Track + fill */}
{/* Value */}
{pct}%
); })}
{/* Legend footnote */}

Contribution weights are learned during multimodal fusion training on FF++ + DFDC datasets.

); }