Jdp-08 commited on
Commit
0f0de7e
·
verified ·
1 Parent(s): a5ce3c4

Update index.html

Browse files
Files changed (1) hide show
  1. index.html +60 -12
index.html CHANGED
@@ -70,7 +70,10 @@
70
  <!-- Preview -->
71
  <div id="previewSection" class="hidden mb-8 p-6 bg-gray-900/50 rounded-xl">
72
  <div class="flex flex-col lg:flex-row gap-6 items-start">
73
- <img id="previewImg" class="flex-1 max-h-80 object-contain rounded-lg shadow-md mx-auto lg:mx-0" alt="Preview">
 
 
 
74
  <div id="fileInfo" class="flex-1 min-w-0"></div>
75
  </div>
76
  </div>
@@ -85,7 +88,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 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,7 +130,7 @@
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>
@@ -137,7 +140,10 @@
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>
139
  <p><span class="text-gray-500">SHA256:</span> <span id="hashValue" class="font-mono text-xs break-all"></span></p>
140
- <p><span class="text-gray-500">Metadata Risk:</span> <span id="metadataRisk"></span></p>
 
 
 
141
  <p><span class="text-gray-500">Models Used:</span> <span id="modelsUsed"></span></p>
142
  </div>
143
 
@@ -178,17 +184,40 @@ function handleFiles(files) {
178
 
179
  function showPreview(file) {
180
  const url = URL.createObjectURL(file);
181
- document.getElementById('previewImg').src = url;
 
 
 
 
 
 
 
 
 
 
 
 
 
 
182
  document.getElementById('fileInfo').innerHTML = `
183
  <div class="space-y-2">
184
  <div class="flex items-center text-sm">
185
- <i class="fas fa-image mr-2 text-blue-400"></i>
186
  <span class="font-semibold text-gray-200 truncate">${file.name}</span>
187
  </div>
188
  <p class="text-gray-500 text-sm">${formatBytes(file.size)}</p>
 
189
  </div>`;
 
190
  document.getElementById('previewSection').classList.remove('hidden');
191
  analyzeBtn.classList.remove('hidden');
 
 
 
 
 
 
 
192
  }
193
 
194
  function formatBytes(bytes) {
@@ -207,9 +236,11 @@ analyzeBtn.addEventListener('click', async () => {
207
  analyzeBtn.style.display = 'none';
208
  document.getElementById('progressSection').classList.remove('hidden');
209
 
 
 
210
  let progress = 0;
211
  const interval = setInterval(() => {
212
- progress += 3;
213
  if (progress > 90) progress = 90;
214
  document.getElementById('progressBar').style.width = progress + '%';
215
  document.getElementById('progressText').textContent = progress + '%';
@@ -246,6 +277,7 @@ function showResults(data) {
246
  section.scrollIntoView({ behavior: 'smooth' });
247
 
248
  const isAuthentic = data.authenticity > 50;
 
249
  const iconEl = document.getElementById('resultIcon');
250
 
251
  // confidence warning
@@ -265,21 +297,34 @@ function showResults(data) {
265
  // verdict
266
  if (isAuthentic) {
267
  iconEl.innerHTML = '<i class="fas fa-check text-green-500 text-2xl"></i>';
268
- document.getElementById('resultTitle').textContent = 'Authentic Media Detected';
269
  document.getElementById('resultSubtitle').textContent = 'No synthetic manipulation found.';
270
  } else {
271
  iconEl.innerHTML = '<i class="fas fa-triangle-exclamation text-orange-500 text-2xl"></i>';
272
- document.getElementById('resultTitle').textContent = 'Potential Deepfake Detected';
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;
@@ -292,6 +337,7 @@ function showResults(data) {
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'}
@@ -302,7 +348,7 @@ function showResults(data) {
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;
@@ -322,6 +368,8 @@ function resetUI() {
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>
 
70
  <!-- Preview -->
71
  <div id="previewSection" class="hidden mb-8 p-6 bg-gray-900/50 rounded-xl">
72
  <div class="flex flex-col lg:flex-row gap-6 items-start">
73
+ <!-- image preview -->
74
+ <img id="previewImg" class="hidden flex-1 max-h-80 object-contain rounded-lg shadow-md mx-auto lg:mx-0" alt="Preview">
75
+ <!-- video preview -->
76
+ <video id="previewVideo" class="hidden flex-1 max-h-80 rounded-lg shadow-md mx-auto lg:mx-0" controls muted></video>
77
  <div id="fileInfo" class="flex-1 min-w-0"></div>
78
  </div>
79
  </div>
 
88
  <div class="text-center mb-8">
89
  <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>
90
  <p class="text-2xl font-semibold text-gray-100">Analyzing file</p>
91
+ <p id="progressLabel" class="text-gray-500 mt-2 text-sm">Running forensic analysis with Groq Llama 4 Vision...</p>
92
  </div>
93
  <div class="w-full bg-gray-800 rounded-lg h-2.5 overflow-hidden">
94
  <div id="progressBar" class="progress-bar bg-blue-600 h-2.5 w-0"></div>
 
130
  <div id="modelBreakdown" class="space-y-4"></div>
131
  </div>
132
 
133
+ <!-- AI Reasoning -->
134
  <div id="groqReasoningSection" class="hidden mb-10">
135
  <h4 class="text-sm font-semibold text-gray-400 uppercase tracking-wider mb-4">AI Reasoning</h4>
136
  <div id="groqReasoning" class="p-4 bg-gray-900/50 rounded-xl border border-gray-700 text-sm text-gray-300 leading-relaxed"></div>
 
140
  <div class="p-5 bg-gray-900/50 rounded-xl border border-gray-700 mb-10 text-sm text-gray-400 space-y-2">
141
  <h4 class="text-sm font-semibold text-gray-400 uppercase tracking-wider mb-3">Forensic Details</h4>
142
  <p><span class="text-gray-500">SHA256:</span> <span id="hashValue" class="font-mono text-xs break-all"></span></p>
143
+ <p id="metadataRiskRow"><span class="text-gray-500">Metadata Risk:</span> <span id="metadataRisk"></span></p>
144
+ <!-- video only -->
145
+ <p id="framesRow" class="hidden"><span class="text-gray-500">Frames Analyzed:</span> <span id="framesAnalyzed"></span></p>
146
+ <p id="durationRow" class="hidden"><span class="text-gray-500">Video Duration:</span> <span id="videoDuration"></span></p>
147
  <p><span class="text-gray-500">Models Used:</span> <span id="modelsUsed"></span></p>
148
  </div>
149
 
 
184
 
185
  function showPreview(file) {
186
  const url = URL.createObjectURL(file);
187
+ const isVideo = file.type.startsWith('video/');
188
+
189
+ const imgEl = document.getElementById('previewImg');
190
+ const videoEl = document.getElementById('previewVideo');
191
+
192
+ if (isVideo) {
193
+ imgEl.classList.add('hidden');
194
+ videoEl.classList.remove('hidden');
195
+ videoEl.src = url;
196
+ } else {
197
+ videoEl.classList.add('hidden');
198
+ imgEl.classList.remove('hidden');
199
+ imgEl.src = url;
200
+ }
201
+
202
  document.getElementById('fileInfo').innerHTML = `
203
  <div class="space-y-2">
204
  <div class="flex items-center text-sm">
205
+ <i class="fas fa-${isVideo ? 'video' : 'image'} mr-2 text-blue-400"></i>
206
  <span class="font-semibold text-gray-200 truncate">${file.name}</span>
207
  </div>
208
  <p class="text-gray-500 text-sm">${formatBytes(file.size)}</p>
209
+ ${isVideo ? '<p class="text-yellow-400 text-xs mt-2"><i class="fas fa-clock mr-1"></i>Video analysis takes ~30-60s (5 frames)</p>' : ''}
210
  </div>`;
211
+
212
  document.getElementById('previewSection').classList.remove('hidden');
213
  analyzeBtn.classList.remove('hidden');
214
+
215
+ // update progress label for video
216
+ if (isVideo) {
217
+ document.getElementById('progressLabel').textContent = 'Analyzing 5 key frames with Groq Llama 4 Vision...';
218
+ } else {
219
+ document.getElementById('progressLabel').textContent = 'Running forensic analysis with Groq Llama 4 Vision...';
220
+ }
221
  }
222
 
223
  function formatBytes(bytes) {
 
236
  analyzeBtn.style.display = 'none';
237
  document.getElementById('progressSection').classList.remove('hidden');
238
 
239
+ // video takes longer so slower progress
240
+ const isVideo = file.type.startsWith('video/');
241
  let progress = 0;
242
  const interval = setInterval(() => {
243
+ progress += isVideo ? 1 : 3;
244
  if (progress > 90) progress = 90;
245
  document.getElementById('progressBar').style.width = progress + '%';
246
  document.getElementById('progressText').textContent = progress + '%';
 
277
  section.scrollIntoView({ behavior: 'smooth' });
278
 
279
  const isAuthentic = data.authenticity > 50;
280
+ const isVideo = data.type === 'video';
281
  const iconEl = document.getElementById('resultIcon');
282
 
283
  // confidence warning
 
297
  // verdict
298
  if (isAuthentic) {
299
  iconEl.innerHTML = '<i class="fas fa-check text-green-500 text-2xl"></i>';
300
+ document.getElementById('resultTitle').textContent = isVideo ? 'Authentic Video Detected' : 'Authentic Media Detected';
301
  document.getElementById('resultSubtitle').textContent = 'No synthetic manipulation found.';
302
  } else {
303
  iconEl.innerHTML = '<i class="fas fa-triangle-exclamation text-orange-500 text-2xl"></i>';
304
+ document.getElementById('resultTitle').textContent = isVideo ? 'Potential Deepfake Video Detected' : 'Potential Deepfake Detected';
305
  document.getElementById('resultSubtitle').textContent = 'Signs of fabrication detected.';
306
  }
307
 
308
  document.getElementById('scoreReal').textContent = Math.round(data.authenticity) + '%';
309
  document.getElementById('scoreFake').textContent = Math.round(data.fake) + '%';
310
  document.getElementById('hashValue').textContent = data.sha256;
 
311
  document.getElementById('modelsUsed').textContent = (data.models_used || []).join(', ');
312
 
313
+ // forensic details different for video vs image
314
+ if (isVideo) {
315
+ document.getElementById('metadataRiskRow').classList.add('hidden');
316
+ document.getElementById('framesRow').classList.remove('hidden');
317
+ document.getElementById('durationRow').classList.remove('hidden');
318
+ document.getElementById('framesAnalyzed').textContent = data.details.frames_analyzed + ' frames';
319
+ document.getElementById('videoDuration').textContent = data.details.video_duration + 's';
320
+ } else {
321
+ document.getElementById('metadataRiskRow').classList.remove('hidden');
322
+ document.getElementById('framesRow').classList.add('hidden');
323
+ document.getElementById('durationRow').classList.add('hidden');
324
+ document.getElementById('metadataRisk').textContent = data.details.metadata_risk;
325
+ }
326
+
327
+ // model breakdown
328
  const modelDiv = document.getElementById('modelBreakdown');
329
  modelDiv.innerHTML = '';
330
  const score = data.details.groq_score;
 
337
  <div class="flex justify-between items-center mb-2">
338
  <span class="text-sm text-gray-300 font-medium">
339
  <i class="fas fa-brain mr-2 text-orange-400"></i>Groq Llama 4 Vision
340
+ ${isVideo ? '<span class="ml-2 text-xs text-gray-500">(avg of 5 frames)</span>' : ''}
341
  </span>
342
  <span class="text-sm font-bold ${textColor}">
343
  ${isUnavailable ? 'Unavailable' : pct + '% fake'}
 
348
  </div>
349
  </div>`;
350
 
351
+ // AI reasoning
352
  if (data.details.groq_reasoning) {
353
  document.getElementById('groqReasoningSection').classList.remove('hidden');
354
  document.getElementById('groqReasoning').textContent = data.details.groq_reasoning;
 
368
  document.getElementById('progressText').textContent = '0%';
369
  document.getElementById('confidenceWarning').classList.add('hidden');
370
  document.getElementById('groqReasoningSection').classList.add('hidden');
371
+ document.getElementById('previewImg').classList.add('hidden');
372
+ document.getElementById('previewVideo').classList.add('hidden');
373
  fileInput.value = '';
374
  }
375
  </script>