Samarth043 commited on
Commit
f412e6a
·
verified ·
1 Parent(s): def45de

Update index.html

Browse files
Files changed (1) hide show
  1. index.html +27 -9
index.html CHANGED
@@ -12,7 +12,9 @@ p{color:#93a3b1}
12
  input{display:block;width:100%;margin:16px 0;padding:14px;background:#18212a;border:2px dashed #2c3844;border-radius:12px;color:#e8eef3}
13
  img{max-width:100%;border-radius:10px;margin-top:8px}
14
  #res{background:#18212a;border-radius:12px;padding:16px;margin-top:16px;display:none}
15
- h2{margin:0 0 6px}
 
 
16
  .bar{height:12px;background:#2c3844;border-radius:6px;overflow:hidden;margin:8px 0}
17
  .bar div{height:100%;background:#6f93ff;width:0}
18
  li{color:#f0b04a;margin:4px 0}
@@ -27,10 +29,13 @@ small{color:#93a3b1}
27
  <img id="p" alt="">
28
  <div id="res">
29
  <h2 id="v"></h2>
 
 
 
 
30
  <div id="pct"></div>
31
  <div class="bar"><div id="b"></div></div>
32
- <ul id="m"></ul>
33
- <small id="raw"></small><br>
34
  <small>A probability, not proof. Detectors can be wrong, especially on new generators and screenshots.</small>
35
  </div>
36
  </main>
@@ -53,13 +58,14 @@ function markers(bytes){
53
  if(/Steps:\s*\d+,\s*Sampler|negative prompt|"class_type"/i.test(t)) out.push('Contains a generation prompt or settings');
54
  return out;
55
  }
 
56
  $('f').onchange = async e => {
57
  const file = e.target.files[0]; if(!file) return;
58
  const url = URL.createObjectURL(file);
59
  $('p').src = url;
60
  $('res').style.display = 'block';
61
  $('v').textContent = 'Loading model, please wait...';
62
- $('pct').textContent = ''; $('b').style.width = '0'; $('m').innerHTML = ''; $('raw').textContent = '';
63
  try {
64
  const mk = markers(new Uint8Array(await file.arrayBuffer()));
65
  await load();
@@ -72,11 +78,23 @@ $('f').onchange = async e => {
72
  if(z.length === 1){ ai = 1 / (1 + Math.exp(-z[0])); }
73
  else { const m = Math.max(...z), ex = z.map(v => Math.exp(v - m)), s = ex.reduce((a,b) => a + b, 0); ai = ex[1] / s; }
74
  $('raw').textContent = 'Raw model score: ' + z.map(v => v.toFixed(2)).join(', ');
75
- mk.forEach(t => { const li = document.createElement('li'); li.textContent = t; $('m').appendChild(li); });
76
- if(mk.length) $('v').textContent = 'AI markers found';
77
- else if(ai >= 0.85) $('v').textContent = 'Likely AI-generated';
78
- else if(ai >= 0.5) $('v').textContent = 'Possibly AI';
79
- else $('v').textContent = 'Likely a real photo';
 
 
 
 
 
 
 
 
 
 
 
 
80
  $('pct').textContent = 'Chance it is AI: ' + Math.round(ai*100) + '%';
81
  $('b').style.width = Math.round(ai*100) + '%';
82
  } catch(err){
 
12
  input{display:block;width:100%;margin:16px 0;padding:14px;background:#18212a;border:2px dashed #2c3844;border-radius:12px;color:#e8eef3}
13
  img{max-width:100%;border-radius:10px;margin-top:8px}
14
  #res{background:#18212a;border-radius:12px;padding:16px;margin-top:16px;display:none}
15
+ h2{margin:0 0 6px;font-size:24px}
16
+ h3{margin:16px 0 4px;font-size:15px;color:#93a3b1;font-weight:600}
17
+ #sub{color:#c5d0da;margin:0}
18
  .bar{height:12px;background:#2c3844;border-radius:6px;overflow:hidden;margin:8px 0}
19
  .bar div{height:100%;background:#6f93ff;width:0}
20
  li{color:#f0b04a;margin:4px 0}
 
29
  <img id="p" alt="">
30
  <div id="res">
31
  <h2 id="v"></h2>
32
+ <p id="sub"></p>
33
+ <h3>Hidden labels</h3>
34
+ <ul id="m"></ul>
35
+ <h3>Pixel check</h3>
36
  <div id="pct"></div>
37
  <div class="bar"><div id="b"></div></div>
38
+ <small id="raw"></small><br><br>
 
39
  <small>A probability, not proof. Detectors can be wrong, especially on new generators and screenshots.</small>
40
  </div>
41
  </main>
 
58
  if(/Steps:\s*\d+,\s*Sampler|negative prompt|"class_type"/i.test(t)) out.push('Contains a generation prompt or settings');
59
  return out;
60
  }
61
+ function li(text, color){ const e = document.createElement('li'); e.textContent = text; if(color) e.style.color = color; return e; }
62
  $('f').onchange = async e => {
63
  const file = e.target.files[0]; if(!file) return;
64
  const url = URL.createObjectURL(file);
65
  $('p').src = url;
66
  $('res').style.display = 'block';
67
  $('v').textContent = 'Loading model, please wait...';
68
+ $('sub').textContent = ''; $('pct').textContent = ''; $('b').style.width = '0'; $('m').innerHTML = ''; $('raw').textContent = '';
69
  try {
70
  const mk = markers(new Uint8Array(await file.arrayBuffer()));
71
  await load();
 
78
  if(z.length === 1){ ai = 1 / (1 + Math.exp(-z[0])); }
79
  else { const m = Math.max(...z), ex = z.map(v => Math.exp(v - m)), s = ex.reduce((a,b) => a + b, 0); ai = ex[1] / s; }
80
  $('raw').textContent = 'Raw model score: ' + z.map(v => v.toFixed(2)).join(', ');
81
+ if(mk.length){ mk.forEach(t => $('m').appendChild(li(t))); }
82
+ else { $('m').appendChild(li('None found. Screenshots and forwarded images often lose their labels.', '#93a3b1')); }
83
+ if(mk.length){
84
+ $('v').textContent = 'AI markers found';
85
+ $('sub').textContent = ai >= 0.5
86
+ ? "The file's labels say AI, and the pixel check agrees."
87
+ : "The file's labels say AI. The pixel check disagreed, which happens with some newer generators such as Gemini, so trust the labels.";
88
+ } else if(ai >= 0.85){
89
+ $('v').textContent = 'Likely AI-generated';
90
+ $('sub').textContent = 'No labels found, but the pixel check says AI.';
91
+ } else if(ai >= 0.5){
92
+ $('v').textContent = 'Possibly AI';
93
+ $('sub').textContent = 'No labels found and the pixel check is unsure.';
94
+ } else {
95
+ $('v').textContent = 'No AI signs found';
96
+ $('sub').textContent = 'No labels found and the pixel check says real. This model can miss newer AI images, especially Gemini images and screenshots, so this is not proof.';
97
+ }
98
  $('pct').textContent = 'Chance it is AI: ' + Math.round(ai*100) + '%';
99
  $('b').style.width = Math.round(ai*100) + '%';
100
  } catch(err){