import React from 'react';
import { Shield, ShieldAlert, ShieldCheck, Loader2, Image as ImageIcon } from 'lucide-react';
export default function VisualLens({ result, isLoading }) {
if (isLoading) {
return (
Analyzing image with AI vision model...
);
}
if (!result) {
return (
Visual Lens
Upload an image to detect AI-generated content or deepfakes.
);
}
const getStatusConfig = (label) => {
const l = label?.toLowerCase() || '';
if (l.includes('real')) return { icon: ShieldCheck, color: 'text-emerald-400', bg: 'bg-emerald-500/10', label: 'Verified Real' };
if (l.includes('deepfake') || l.includes('morphed')) return { icon: ShieldAlert, color: 'text-rose-400', bg: 'bg-rose-500/10', label: 'Manipulation Detected' };
return { icon: Shield, color: 'text-sky-400', bg: 'bg-sky-500/10', label: 'AI-Generated' };
};
const status = getStatusConfig(result.label);
const confidence = (result.score || 0) * 100;
const predictions = Array.isArray(result.all_predictions) ? result.all_predictions.filter(Boolean).slice(0, 5) : [];
return (
{status.label}
Classification
{confidence.toFixed(1)}%
{predictions.length > 0 && (
Detection Breakdown
{predictions.map((pred, i) => {
const pLabel = typeof pred === 'object' ? pred.label : pred[0];
const rawScore = typeof pred === 'object' ? pred.score : pred[1];
const pScore = (Number(rawScore) || 0) * 100;
return (
{pLabel}
{pScore.toFixed(1)}%
);
})}
)}
);
}