Spaces:
Paused
Paused
feat: update generator labels and enhance detection response structure
Browse files- frontend/lib/constants.ts +7 -7
- frontend/types/detection.ts +10 -5
- src/engines/fingerprint/engine.py +1 -1
- tests/test_fusion.py +4 -4
frontend/lib/constants.ts
CHANGED
|
@@ -13,14 +13,14 @@ export const VIDEO_FORMAT_LABEL = 'MP4 - MOV - AVI - MAX 500MB'
|
|
| 13 |
|
| 14 |
export const GENERATOR_LABELS: Record<GeneratorLabel, string> = {
|
| 15 |
real: 'Real',
|
| 16 |
-
unknown_gan: 'Unknown GAN',
|
| 17 |
-
stable_diffusion: 'Stable Diffusion',
|
| 18 |
-
midjourney: 'Midjourney',
|
| 19 |
-
dall_e: 'DALL-E',
|
| 20 |
-
flux: 'FLUX',
|
| 21 |
-
firefly: 'Adobe Firefly',
|
| 22 |
-
imagen: 'Google Imagen',
|
| 23 |
sora: 'OpenAI Sora',
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 24 |
}
|
| 25 |
|
| 26 |
export const ENGINE_LABELS: Record<string, string> = {
|
|
|
|
| 13 |
|
| 14 |
export const GENERATOR_LABELS: Record<GeneratorLabel, string> = {
|
| 15 |
real: 'Real',
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 16 |
sora: 'OpenAI Sora',
|
| 17 |
+
runway: 'Runway Gen-2',
|
| 18 |
+
wav2lip: 'Wav2Lip',
|
| 19 |
+
stable_diffusion: 'Stable Diffusion v1.5',
|
| 20 |
+
sdxl: 'Stable Diffusion XL',
|
| 21 |
+
midjourney: 'Midjourney',
|
| 22 |
+
dall_e: 'DALL-E 3',
|
| 23 |
+
unknown_generative: 'Unknown Generative',
|
| 24 |
}
|
| 25 |
|
| 26 |
export const ENGINE_LABELS: Record<string, string> = {
|
frontend/types/detection.ts
CHANGED
|
@@ -5,14 +5,14 @@ export type Verdict = 'FAKE' | 'REAL' | 'UNKNOWN'
|
|
| 5 |
|
| 6 |
export type GeneratorLabel =
|
| 7 |
| 'real'
|
| 8 |
-
| '
|
|
|
|
|
|
|
| 9 |
| 'stable_diffusion'
|
|
|
|
| 10 |
| 'midjourney'
|
| 11 |
| 'dall_e'
|
| 12 |
-
| '
|
| 13 |
-
| 'firefly'
|
| 14 |
-
| 'imagen'
|
| 15 |
-
| 'sora'
|
| 16 |
|
| 17 |
export interface EngineResult {
|
| 18 |
engine: string
|
|
@@ -21,6 +21,8 @@ export interface EngineResult {
|
|
| 21 |
attributed_generator?: GeneratorLabel | string | null
|
| 22 |
explanation: string
|
| 23 |
processing_time_ms: number
|
|
|
|
|
|
|
| 24 |
}
|
| 25 |
|
| 26 |
export interface DetectionResponse {
|
|
@@ -30,6 +32,9 @@ export interface DetectionResponse {
|
|
| 30 |
explanation: string
|
| 31 |
processing_time_ms: number
|
| 32 |
engine_breakdown: EngineResult[]
|
|
|
|
|
|
|
|
|
|
| 33 |
}
|
| 34 |
|
| 35 |
export type MediaType = 'image' | 'video'
|
|
|
|
| 5 |
|
| 6 |
export type GeneratorLabel =
|
| 7 |
| 'real'
|
| 8 |
+
| 'sora'
|
| 9 |
+
| 'runway'
|
| 10 |
+
| 'wav2lip'
|
| 11 |
| 'stable_diffusion'
|
| 12 |
+
| 'sdxl'
|
| 13 |
| 'midjourney'
|
| 14 |
| 'dall_e'
|
| 15 |
+
| 'unknown_generative'
|
|
|
|
|
|
|
|
|
|
| 16 |
|
| 17 |
export interface EngineResult {
|
| 18 |
engine: string
|
|
|
|
| 21 |
attributed_generator?: GeneratorLabel | string | null
|
| 22 |
explanation: string
|
| 23 |
processing_time_ms: number
|
| 24 |
+
audio_sync_score?: number | null
|
| 25 |
+
timestamp_markers?: Array<Record<string, unknown>>
|
| 26 |
}
|
| 27 |
|
| 28 |
export interface DetectionResponse {
|
|
|
|
| 32 |
explanation: string
|
| 33 |
processing_time_ms: number
|
| 34 |
engine_breakdown: EngineResult[]
|
| 35 |
+
novelty_score?: number | null
|
| 36 |
+
audio_sync_score?: number | null
|
| 37 |
+
timestamp_markers?: Array<Record<string, unknown>>
|
| 38 |
}
|
| 39 |
|
| 40 |
export type MediaType = 'image' | 'video'
|
src/engines/fingerprint/engine.py
CHANGED
|
@@ -321,7 +321,7 @@ class FingerprintEngine:
|
|
| 321 |
|
| 322 |
avg_conf = float(np.mean([result.confidence for result in results]))
|
| 323 |
generators = [result.attributed_generator for result in results if result.attributed_generator]
|
| 324 |
-
top_gen = max(set(generators), key=generators.count) if generators else "
|
| 325 |
|
| 326 |
return EngineResult(
|
| 327 |
engine="fingerprint",
|
|
|
|
| 321 |
|
| 322 |
avg_conf = float(np.mean([result.confidence for result in results]))
|
| 323 |
generators = [result.attributed_generator for result in results if result.attributed_generator]
|
| 324 |
+
top_gen = max(set(generators), key=generators.count) if generators else "unknown_generative"
|
| 325 |
|
| 326 |
return EngineResult(
|
| 327 |
engine="fingerprint",
|
tests/test_fusion.py
CHANGED
|
@@ -73,15 +73,15 @@ def test_fuser_real_verdict_sets_generator_real():
|
|
| 73 |
|
| 74 |
|
| 75 |
def test_types_generator_label_count():
|
| 76 |
-
assert len(GeneratorLabel) ==
|
| 77 |
|
| 78 |
|
| 79 |
def test_types_generator_index_mapping():
|
| 80 |
from src.types import GENERATOR_INDEX_TO_LABEL
|
| 81 |
assert GENERATOR_INDEX_TO_LABEL[0] == GeneratorLabel.real
|
| 82 |
-
assert GENERATOR_INDEX_TO_LABEL[1] == GeneratorLabel.
|
| 83 |
-
assert GENERATOR_INDEX_TO_LABEL[
|
| 84 |
-
assert GENERATOR_INDEX_TO_LABEL[
|
| 85 |
|
| 86 |
|
| 87 |
def test_engine_result_confidence_validator():
|
|
|
|
| 73 |
|
| 74 |
|
| 75 |
def test_types_generator_label_count():
|
| 76 |
+
assert len(GeneratorLabel) == 9
|
| 77 |
|
| 78 |
|
| 79 |
def test_types_generator_index_mapping():
|
| 80 |
from src.types import GENERATOR_INDEX_TO_LABEL
|
| 81 |
assert GENERATOR_INDEX_TO_LABEL[0] == GeneratorLabel.real
|
| 82 |
+
assert GENERATOR_INDEX_TO_LABEL[1] == GeneratorLabel.sora
|
| 83 |
+
assert GENERATOR_INDEX_TO_LABEL[4] == GeneratorLabel.stable_diffusion
|
| 84 |
+
assert GENERATOR_INDEX_TO_LABEL[8] == GeneratorLabel.unknown_generative
|
| 85 |
|
| 86 |
|
| 87 |
def test_engine_result_confidence_validator():
|