Update index.html
Browse files- index.html +37 -33
index.html
CHANGED
|
@@ -85,7 +85,7 @@
|
|
| 85 |
<div class="text-center mb-8">
|
| 86 |
<div class="w-12 h-12 border-4 border-blue-500/20 border-t-blue-500 rounded-full animate-spin mx-auto mb-6"></div>
|
| 87 |
<p class="text-2xl font-semibold text-gray-100">Analyzing file</p>
|
| 88 |
-
<p class="text-gray-500 mt-2 text-sm">Running
|
| 89 |
</div>
|
| 90 |
<div class="w-full bg-gray-800 rounded-lg h-2.5 overflow-hidden">
|
| 91 |
<div id="progressBar" class="progress-bar bg-blue-600 h-2.5 w-0"></div>
|
|
@@ -127,6 +127,12 @@
|
|
| 127 |
<div id="modelBreakdown" class="space-y-4"></div>
|
| 128 |
</div>
|
| 129 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 130 |
<!-- Forensic details -->
|
| 131 |
<div class="p-5 bg-gray-900/50 rounded-xl border border-gray-700 mb-10 text-sm text-gray-400 space-y-2">
|
| 132 |
<h4 class="text-sm font-semibold text-gray-400 uppercase tracking-wider mb-3">Forensic Details</h4>
|
|
@@ -155,7 +161,6 @@ const uploadArea = document.getElementById('uploadArea');
|
|
| 155 |
const fileInput = document.getElementById('fileInput');
|
| 156 |
const analyzeBtn = document.getElementById('analyzeBtn');
|
| 157 |
|
| 158 |
-
// ---------------- DRAG & DROP ----------------
|
| 159 |
['dragenter', 'dragover', 'dragleave', 'drop'].forEach(e => {
|
| 160 |
uploadArea.addEventListener(e, ev => { ev.preventDefault(); ev.stopPropagation(); });
|
| 161 |
});
|
|
@@ -164,7 +169,6 @@ const analyzeBtn = document.getElementById('analyzeBtn');
|
|
| 164 |
uploadArea.addEventListener('drop', e => handleFiles(e.dataTransfer.files));
|
| 165 |
fileInput.addEventListener('change', e => handleFiles(e.target.files));
|
| 166 |
|
| 167 |
-
// ---------------- FILE HANDLING ----------------
|
| 168 |
function handleFiles(files) {
|
| 169 |
if (!files.length) return;
|
| 170 |
const file = files[0];
|
|
@@ -194,7 +198,6 @@ function formatBytes(bytes) {
|
|
| 194 |
return (bytes / Math.pow(1024, i)).toFixed(1) + ' ' + sizes[i];
|
| 195 |
}
|
| 196 |
|
| 197 |
-
// ---------------- ANALYZE ----------------
|
| 198 |
analyzeBtn.addEventListener('click', async () => {
|
| 199 |
const file = fileInput.files[0];
|
| 200 |
if (!file) return;
|
|
@@ -237,7 +240,6 @@ analyzeBtn.addEventListener('click', async () => {
|
|
| 237 |
}
|
| 238 |
});
|
| 239 |
|
| 240 |
-
// ---------------- SHOW RESULTS ----------------
|
| 241 |
function showResults(data) {
|
| 242 |
const section = document.getElementById('resultsSection');
|
| 243 |
section.classList.remove('hidden');
|
|
@@ -251,7 +253,7 @@ function showResults(data) {
|
|
| 251 |
if (data.confidence_level === 'low') {
|
| 252 |
warningEl.classList.remove('hidden');
|
| 253 |
warningEl.className = 'mb-6 p-4 rounded-xl border text-sm font-medium bg-yellow-900/30 border-yellow-700 text-yellow-400';
|
| 254 |
-
warningEl.innerHTML = '<i class="fas fa-triangle-exclamation mr-2"></i>Low confidence —
|
| 255 |
} else if (data.confidence_level === 'medium') {
|
| 256 |
warningEl.classList.remove('hidden');
|
| 257 |
warningEl.className = 'mb-6 p-4 rounded-xl border text-sm font-medium bg-blue-900/30 border-blue-700 text-blue-400';
|
|
@@ -271,43 +273,44 @@ function showResults(data) {
|
|
| 271 |
document.getElementById('resultSubtitle').textContent = 'Signs of fabrication detected.';
|
| 272 |
}
|
| 273 |
|
| 274 |
-
// scores
|
| 275 |
document.getElementById('scoreReal').textContent = Math.round(data.authenticity) + '%';
|
| 276 |
document.getElementById('scoreFake').textContent = Math.round(data.fake) + '%';
|
| 277 |
-
|
| 278 |
-
// forensic details
|
| 279 |
document.getElementById('hashValue').textContent = data.sha256;
|
| 280 |
document.getElementById('metadataRisk').textContent = data.details.metadata_risk;
|
| 281 |
document.getElementById('modelsUsed').textContent = (data.models_used || []).join(', ');
|
| 282 |
|
| 283 |
-
//
|
| 284 |
const modelDiv = document.getElementById('modelBreakdown');
|
| 285 |
modelDiv.innerHTML = '';
|
| 286 |
-
|
| 287 |
-
|
| 288 |
-
|
| 289 |
-
|
| 290 |
-
|
| 291 |
-
|
| 292 |
-
|
| 293 |
-
|
| 294 |
-
|
| 295 |
-
|
| 296 |
-
|
| 297 |
-
<
|
| 298 |
-
|
| 299 |
-
|
| 300 |
-
|
| 301 |
-
|
| 302 |
-
</div>
|
| 303 |
-
|
| 304 |
-
|
| 305 |
-
|
| 306 |
-
|
| 307 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 308 |
}
|
| 309 |
|
| 310 |
-
// ---------------- RESET ----------------
|
| 311 |
function resetUI() {
|
| 312 |
document.getElementById('resultsSection').classList.add('hidden');
|
| 313 |
document.getElementById('uploadArea').style.display = 'block';
|
|
@@ -318,6 +321,7 @@ function resetUI() {
|
|
| 318 |
document.getElementById('progressBar').style.width = '0%';
|
| 319 |
document.getElementById('progressText').textContent = '0%';
|
| 320 |
document.getElementById('confidenceWarning').classList.add('hidden');
|
|
|
|
| 321 |
fileInput.value = '';
|
| 322 |
}
|
| 323 |
</script>
|
|
|
|
| 85 |
<div class="text-center mb-8">
|
| 86 |
<div class="w-12 h-12 border-4 border-blue-500/20 border-t-blue-500 rounded-full animate-spin mx-auto mb-6"></div>
|
| 87 |
<p class="text-2xl font-semibold text-gray-100">Analyzing file</p>
|
| 88 |
+
<p class="text-gray-500 mt-2 text-sm">Running forensic analysis with Groq Llama 4 Vision...</p>
|
| 89 |
</div>
|
| 90 |
<div class="w-full bg-gray-800 rounded-lg h-2.5 overflow-hidden">
|
| 91 |
<div id="progressBar" class="progress-bar bg-blue-600 h-2.5 w-0"></div>
|
|
|
|
| 127 |
<div id="modelBreakdown" class="space-y-4"></div>
|
| 128 |
</div>
|
| 129 |
|
| 130 |
+
<!-- Groq Reasoning -->
|
| 131 |
+
<div id="groqReasoningSection" class="hidden mb-10">
|
| 132 |
+
<h4 class="text-sm font-semibold text-gray-400 uppercase tracking-wider mb-4">AI Reasoning</h4>
|
| 133 |
+
<div id="groqReasoning" class="p-4 bg-gray-900/50 rounded-xl border border-gray-700 text-sm text-gray-300 leading-relaxed"></div>
|
| 134 |
+
</div>
|
| 135 |
+
|
| 136 |
<!-- Forensic details -->
|
| 137 |
<div class="p-5 bg-gray-900/50 rounded-xl border border-gray-700 mb-10 text-sm text-gray-400 space-y-2">
|
| 138 |
<h4 class="text-sm font-semibold text-gray-400 uppercase tracking-wider mb-3">Forensic Details</h4>
|
|
|
|
| 161 |
const fileInput = document.getElementById('fileInput');
|
| 162 |
const analyzeBtn = document.getElementById('analyzeBtn');
|
| 163 |
|
|
|
|
| 164 |
['dragenter', 'dragover', 'dragleave', 'drop'].forEach(e => {
|
| 165 |
uploadArea.addEventListener(e, ev => { ev.preventDefault(); ev.stopPropagation(); });
|
| 166 |
});
|
|
|
|
| 169 |
uploadArea.addEventListener('drop', e => handleFiles(e.dataTransfer.files));
|
| 170 |
fileInput.addEventListener('change', e => handleFiles(e.target.files));
|
| 171 |
|
|
|
|
| 172 |
function handleFiles(files) {
|
| 173 |
if (!files.length) return;
|
| 174 |
const file = files[0];
|
|
|
|
| 198 |
return (bytes / Math.pow(1024, i)).toFixed(1) + ' ' + sizes[i];
|
| 199 |
}
|
| 200 |
|
|
|
|
| 201 |
analyzeBtn.addEventListener('click', async () => {
|
| 202 |
const file = fileInput.files[0];
|
| 203 |
if (!file) return;
|
|
|
|
| 240 |
}
|
| 241 |
});
|
| 242 |
|
|
|
|
| 243 |
function showResults(data) {
|
| 244 |
const section = document.getElementById('resultsSection');
|
| 245 |
section.classList.remove('hidden');
|
|
|
|
| 253 |
if (data.confidence_level === 'low') {
|
| 254 |
warningEl.classList.remove('hidden');
|
| 255 |
warningEl.className = 'mb-6 p-4 rounded-xl border text-sm font-medium bg-yellow-900/30 border-yellow-700 text-yellow-400';
|
| 256 |
+
warningEl.innerHTML = '<i class="fas fa-triangle-exclamation mr-2"></i>Low confidence — model could not confidently determine authenticity. Result may not be reliable.';
|
| 257 |
} else if (data.confidence_level === 'medium') {
|
| 258 |
warningEl.classList.remove('hidden');
|
| 259 |
warningEl.className = 'mb-6 p-4 rounded-xl border text-sm font-medium bg-blue-900/30 border-blue-700 text-blue-400';
|
|
|
|
| 273 |
document.getElementById('resultSubtitle').textContent = 'Signs of fabrication detected.';
|
| 274 |
}
|
| 275 |
|
|
|
|
| 276 |
document.getElementById('scoreReal').textContent = Math.round(data.authenticity) + '%';
|
| 277 |
document.getElementById('scoreFake').textContent = Math.round(data.fake) + '%';
|
|
|
|
|
|
|
| 278 |
document.getElementById('hashValue').textContent = data.sha256;
|
| 279 |
document.getElementById('metadataRisk').textContent = data.details.metadata_risk;
|
| 280 |
document.getElementById('modelsUsed').textContent = (data.models_used || []).join(', ');
|
| 281 |
|
| 282 |
+
// only Groq in model breakdown
|
| 283 |
const modelDiv = document.getElementById('modelBreakdown');
|
| 284 |
modelDiv.innerHTML = '';
|
| 285 |
+
const score = data.details.groq_score;
|
| 286 |
+
const isUnavailable = score === 'unavailable' || score === null;
|
| 287 |
+
const pct = isUnavailable ? 0 : Math.round(score * 100);
|
| 288 |
+
const color = isUnavailable ? 'bg-gray-600' : score > 0.5 ? 'bg-red-500' : 'bg-green-500';
|
| 289 |
+
const textColor = isUnavailable ? 'text-gray-500' : score > 0.5 ? 'text-red-400' : 'text-green-400';
|
| 290 |
+
modelDiv.innerHTML = `
|
| 291 |
+
<div class="p-4 bg-gray-900/50 rounded-xl border border-gray-700">
|
| 292 |
+
<div class="flex justify-between items-center mb-2">
|
| 293 |
+
<span class="text-sm text-gray-300 font-medium">
|
| 294 |
+
<i class="fas fa-brain mr-2 text-orange-400"></i>Groq Llama 4 Vision
|
| 295 |
+
</span>
|
| 296 |
+
<span class="text-sm font-bold ${textColor}">
|
| 297 |
+
${isUnavailable ? 'Unavailable' : pct + '% fake'}
|
| 298 |
+
</span>
|
| 299 |
+
</div>
|
| 300 |
+
<div class="w-full bg-gray-800 rounded-full h-2">
|
| 301 |
+
<div class="${color} h-2 rounded-full transition-all" style="width: ${pct}%"></div>
|
| 302 |
+
</div>
|
| 303 |
+
</div>`;
|
| 304 |
+
|
| 305 |
+
// show groq reasoning if available
|
| 306 |
+
if (data.details.groq_reasoning) {
|
| 307 |
+
document.getElementById('groqReasoningSection').classList.remove('hidden');
|
| 308 |
+
document.getElementById('groqReasoning').textContent = data.details.groq_reasoning;
|
| 309 |
+
} else {
|
| 310 |
+
document.getElementById('groqReasoningSection').classList.add('hidden');
|
| 311 |
+
}
|
| 312 |
}
|
| 313 |
|
|
|
|
| 314 |
function resetUI() {
|
| 315 |
document.getElementById('resultsSection').classList.add('hidden');
|
| 316 |
document.getElementById('uploadArea').style.display = 'block';
|
|
|
|
| 321 |
document.getElementById('progressBar').style.width = '0%';
|
| 322 |
document.getElementById('progressText').textContent = '0%';
|
| 323 |
document.getElementById('confidenceWarning').classList.add('hidden');
|
| 324 |
+
document.getElementById('groqReasoningSection').classList.add('hidden');
|
| 325 |
fileInput.value = '';
|
| 326 |
}
|
| 327 |
</script>
|