Spaces:
Sleeping
Sleeping
Aisnsio
Claude Opus 5.5
feat: Eagle EYE Verify — AI-media + fake-news verification with review queue and integration API
e7d800d Download test/forensics.test.js from AisnsioDev/EagleEyeVerify: direct link, hf CLI and curl.
- Browser
- Download file 2.1 kB
-
https://huggingface.co/spaces/AisnsioDev/EagleEyeVerify/resolve/main/test/forensics.test.js
- Command line
-
hf download hf://spaces/AisnsioDev/EagleEyeVerify/test/forensics.test.js
-
curl -L -o forensics.test.js https://huggingface.co/spaces/AisnsioDev/EagleEyeVerify/resolve/main/test/forensics.test.js
2.1 kB
| import { test } from 'node:test'; | |
| import assert from 'node:assert/strict'; | |
| import { scanMetadata, fuse } from '../server/forensics.js'; | |
| const jpeg = s => Buffer.concat([Buffer.from([0xff, 0xd8, 0xff, 0xe1]), Buffer.from(s, 'latin1')]); | |
| test('IPTC trainedAlgorithmicMedia is a provenance declaration of AI', () => { | |
| const m = scanMetadata(jpeg('<Iptc4xmpExt:DigitalSourceType>http://cv.iptc.org/newscodes/digitalsourcetype/trainedAlgorithmicMedia</Iptc4xmpExt:DigitalSourceType>')); | |
| assert.equal(m.declaredAI, true); | |
| const r = fuse(m, [], null); | |
| assert.ok(r.score >= 0.97); assert.equal(r.label, 'likely_ai'); | |
| }); | |
| test('generator name in metadata is strong evidence', () => { | |
| const m = scanMetadata(jpeg('Software\0Midjourney v7')); | |
| assert.deepEqual(m.generators, ['midjourney']); | |
| assert.equal(fuse(m, [], null).label, 'likely_ai'); | |
| }); | |
| test('SD parameters chunk is detected', () => { | |
| const m = scanMetadata(Buffer.from('\x89PNG....tEXtparameters\0a cat\nNegative prompt: blurry\nSteps: 30, Sampler: Euler a, CFG scale: 7', 'latin1')); | |
| assert.ok(m.signals.some(s => s.weight >= 0.9)); | |
| }); | |
| test('no evidence at all is inconclusive, never "authentic"', () => { | |
| const r = fuse(scanMetadata(jpeg('nothing here')), [], null); | |
| assert.equal(r.label, 'inconclusive'); | |
| }); | |
| test('low model probability on a camera photo reads authentic', () => { | |
| const m = scanMetadata(jpeg('Make\0Apple\0Model\0iPhone 15 Pro')); | |
| const r = fuse(m, [{ provider: 'x', p: 0.1 }], { ai_probability: 0.08, manipulation_probability: 0.05 }); | |
| assert.equal(r.label, 'likely_authentic'); | |
| }); | |
| test('C2PA presence alone is neutral', () => { | |
| const m = scanMetadata(jpeg('jumbf c2pa manifest claim_generator: Adobe Photoshop')); | |
| assert.equal(m.c2pa, true); assert.equal(m.declaredAI, false); | |
| }); | |
| test('random binary does not false-match short generator names', () => { | |
| let fp = 0; | |
| for (let i = 0; i < 20; i++) { | |
| const b = Buffer.alloc(600 * 1024); for (let j = 0; j < b.length; j++) b[j] = Math.random() * 256; | |
| if (scanMetadata(b).generators.length) fp++; | |
| } | |
| assert.equal(fp, 0); | |
| }); | |