File size: 5,959 Bytes
07c4b4b
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
e99191c
07c4b4b
 
 
e99191c
07c4b4b
 
 
 
 
533dd58
07c4b4b
 
fb1554c
07c4b4b
 
 
 
 
 
c5e5be2
07c4b4b
533dd58
 
07c4b4b
e99191c
07c4b4b
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
533dd58
e99191c
90ef606
07c4b4b
 
 
 
 
533dd58
07c4b4b
 
 
 
 
 
 
 
 
 
 
 
ac5eb1b
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
import gradio as gr
import pandas as pd

LEADERBOARD_PATH = "leaderboard.csv"


def load_leaderboard():
    try:
        return pd.read_csv(LEADERBOARD_PATH)
    except FileNotFoundError:
        return pd.DataFrame([{"Status": "No leaderboard data available"}])


def style_leaderboard(df: pd.DataFrame):
    """Return styled HTML with highlighted best performers and professional formatting."""
    if df.empty:
        return "<p>No data available.</p>"

    num_cols = [c for c in df.columns if c not in ["Rank", "Model"]]

    def highlight_best(s):
        if pd.api.types.is_numeric_dtype(s):
            max_val = s.max()
            return ['color: #6AA84F; font-weight: 600;' if v == max_val else '' for v in s]
        return ['' for _ in s]
    df = df.reset_index(drop=True)
    styled = (df.style.apply(highlight_best, subset=num_cols, axis=0).format(precision=1).hide(axis='index'))

    # Professional table styling
    html = styled.to_html()
    return f"""
    <div style="margin: 20px 0;">
        <div style="overflow-x: auto; border: 1px solid #e2e8f0; border-radius: 8px; box-shadow: 0 1px 3px rgba(0,0,0,0.1);">
            <style>
                table {{
                    width: 100%;
                    border-collapse: collapse;
                    font-family: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
                }}
                th {{
                    font-weight: 600;
                    padding: 16px 12px;
                    text-align: left;
                    border-bottom: 2px solid #e2e8f0;
                    font-size: 14px;
                }}
                td {{
                    padding: 12px;
                    border-bottom: 1px solid #f1f5f9;
                    font-size: 14px;
                }}
                tr:hover {{
                    background-color: #7c7d7e;
                }}
            </style>
            {html}
        </div>
    </div>
    """


def leaderboard_view():
    df = load_leaderboard()
    return style_leaderboard(df)


# ---------------- Gradio UI ---------------- #

with gr.Blocks(css="""
    .gradio-container {
        max-width: 1200px !important; 
        margin: auto;
        font-family: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
    }
    #title-image {
        margin: 20px auto; 
        display: block; 
        max-width: 800px;
    }
    .gr-markdown h1 {
        color: #1e293b;
        font-weight: 700;
        margin-bottom: 16px;
    }
    .gr-markdown h2 {
        color: #334155;
        font-weight: 600;
        margin-top: 24px;
        margin-bottom: 12px;
    }
    .gr-markdown h3 {
        color: #475569;
        font-weight: 600;
        margin-bottom: 8px;
    }
    .gr-markdown p {
        color: #64748b;
        line-height: 1.6;
    }
    .gr-tab-nav button {
        font-weight: 500;
    }
""") as demo:
    # Banner image
    gr.Image("title.png", elem_id="title-image", show_label=False)

    # Professional introduction
    gr.Markdown("""
# DFBench: The Image Deepfake Detection Benchmark 2025

DFBench provides a standardized evaluation for computer vision deepfake detection systems.
This leaderboard focuses on image deepfake detection, e.g. the output of text-to-image and image-to-image models.

**Objectives:**
- Allow fair comparison between deepfake detection models on unseen test data (no fine tuning on the test data possible)
- Advance the state-of-the-art in synthetic media identification

""")

    with gr.Tab("Leaderboard"):
        gr.Markdown("## Leaderboard Image Deepfake Detection")
        gr.HTML(leaderboard_view())
        gr.Markdown("""
*The Leaderboard is updated upon validation of new submissions. All results are evaluated on the official [test dataset](https://huggingface.co/datasets/DFBench/DFBench_Image25).*
        """)

    with gr.Tab("Submission Guidelines"):
        gr.Markdown("""
# Model Submission Process

**Official Benchmark Test Dataset:** [DFBench/DFBench_Image25](https://huggingface.co/datasets/DFBench/DFBench_Image25)

The test dataset comprises **2,920 images**. The test data is unlabeled. Each image is either:
- **Real:** An authentic, unmodified image
- **Fake:** AI-generated or synthetically modified content
Since there are no labels, you cannot (and should not) train your model on the test data.
---

## Submission Requirements

### File Format
Submit predictions as a CSV file with the following structure: `filename,label`.
- `filename`: Exact filename as provided in the dataset
- `label`: Binary classification result (`real` or `fake`)

 For example:

```
filename,label
1.jpg,fake
2.jpeg,real
3.webp,fake
...
2920.png,fake
```
### Submission Process

1. Generate predictions for all 2,920 test images
2. Format results according to specification above 
3. Send your CSV file submission to: **submission@df-bench.com**. The name of the file should correspond to the leaderboard model name, e.g. `Model_This_name.csv` will be included as `Model This name` in the leaderboard.

### Evaluation Timeline
- Submissions are processed within 5-7 business days
- Approved submissions are added to the public leaderboard

## Notes
- Each research group may submit one set of scores per month
- All submissions undergo automated validation before leaderboard inclusion
- The authors reserve the right to not publish or to remove a submission at their discretion  
- Submissions may be excluded if found to violate ethical guidelines, contain malicious content, or appear fraudulent  
- Benchmark maintainers may adjust evaluation protocols as the dataset and task evolve  
- No warranties are provided regarding benchmark results, which are intended strictly for research and comparison purposes  


For technical inquiries regarding the evaluation process, please contact the benchmark maintainers through the submission email.
""")

if __name__ == "__main__":
    demo.launch(server_name="0.0.0.0", server_port=7860)