File size: 3,092 Bytes
7c6df6e
 
 
 
17f8d7a
 
 
4d97924
17f8d7a
 
 
 
 
 
 
 
 
 
7c6df6e
 
4d97924
 
17f8d7a
7c6df6e
 
 
17f8d7a
 
 
 
 
7c6df6e
 
 
 
 
17f8d7a
 
 
 
 
17ffd95
4d97924
7d4723c
 
 
 
 
 
17ffd95
4d97924
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
86e4cd2
 
4d97924
 
 
 
 
 
 
 
 
7c6df6e
4d97924
 
fea3595
7c6df6e
 
17f8d7a
972f1f3
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
import gradio as gr
import pipeline

custom_css = """
.gradio-container {
    max-width: 1400px !important;
}
#component-0, #component-1, #component-2, #component-3 {
    min-height: 500px !important;
}
.output-class {
    min-height: 300px !important;
    font-size: 24px !important;
    padding: 30px !important;
}
.input-image, .input-video, .input-audio {
    min-height: 500px !important;
}
"""

title = "EfficientNetV2 Deepfakes Video Detector"
description = "EfficientNetV2 Deepfakes Image Detector by using frame-by-frame detection."

image_interface = gr.Interface(
    fn=pipeline.deepfakes_image_predict,
    inputs=gr.Image(label="Upload Image", height=500),
    outputs=gr.Textbox(label="Detection Result", lines=8, scale=2),
    examples=["images/images_lady.jpg", "images/images_fake_image.jpg"],
    cache_examples=False,
    title="Image Deepfake Detection",
    description="Upload an image to detect if it's real or fake"
)

video_interface = gr.Interface(
    fn=pipeline.deepfakes_video_predict,
    inputs=gr.Video(label="Upload Video", height=500),
    outputs=gr.Textbox(label="Detection Result", lines=8, scale=2),
    examples=["videos/celeb_synthesis.mp4", "videos/real-1.mp4"],
    cache_examples=False,
    title="Video Deepfake Detection",
    description="Upload a video to detect if it's real or fake (frame-by-frame analysis)"
)

audio_interface = gr.Interface(
    fn=pipeline.deepfakes_audio_predict,
    inputs=gr.Audio(),
    outputs=gr.Textbox(),
    title="Audio Deepfake Detection"
)

text_interface = gr.Interface(
    fn=pipeline.deepfakes_text_predict,
    inputs=gr.Textbox(
        label="Input Text",
        placeholder=(
            "Paste any text here to check if it was written by a human or "
            "generated by an AI (articles, essays, emails, descriptions…)"
        ),
        lines=10,
    ),
    outputs=gr.Textbox(
        label="Detection Result",
        lines=10,
    ),
    examples=[
        ["The Eiffel Tower, constructed between 1887 and 1889, was designed by engineer Gustave Eiffel as the entrance arch for the 1889 World's Fair held in Paris."],
        ["In the rapidly evolving landscape of artificial intelligence, large language models have demonstrated remarkable capabilities across a wide range of natural language processing tasks, achieving state-of-the-art performance on numerous benchmarks."],
        ["Yesterday I went to the market and bought some fresh vegetables. The tomatoes looked really good so I grabbed a few extra ones for the pasta sauce I was planning to make for dinner."],
    ],
    cache_examples=False,
    title="AI Text Detection",
    description=(
        "Paste any text to detect whether it was written by a human or generated by an AI. "
        "Powered by a hybrid DeBERTa-v3-small + BiLSTM + CNN + Transformer model."
    ),
)

app = gr.TabbedInterface(
    [image_interface, video_interface, audio_interface, text_interface],
    ["Image inference", "Video inference", "Audio inference", "Text inference"],
    css=custom_css
)

if __name__ == '__main__':
    app.launch()