File size: 1,770 Bytes
ddcedb5
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
94eb978
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
import gradio as gr
import inference_2 as inference

# Title and Description
title = " Multimodal Deepfake Detector"
description = "Detect deepfakes and AI-generated content from videos, audio, and images using advanced AI models."

# Individual Interfaces
video_interface = gr.Interface(
    inference.deepfakes_video_predict,
    inputs=gr.Video(label="Upload a Video"),
    outputs=gr.Textbox(label="Prediction"),
    examples=["videos/aaa.mp4", "videos/bbb.mp4"],
    cache_examples=False
)

image_interface = gr.Interface(
    inference.deepfakes_image_predict,
    inputs=gr.Image(label="Upload an Image"),
    outputs=gr.Textbox(label="Prediction"),
    examples=["images/lady.jpg", "images/fake_image.jpg"],
    cache_examples=False
)

audio_interface = gr.Interface(
    inference.deepfakes_spec_predict,
    inputs=gr.Audio(label="Upload an Audio"),
    outputs=gr.Textbox(label="Prediction"),
    examples=["audios/DF_E_2000027.flac", "audios/DF_E_2000031.flac"],
    cache_examples=False
)

ai_image_detector = gr.Interface(
    fn=inference.detect_ai_generated_image,
    inputs=gr.Image(label="Upload an Image"),
    outputs=gr.Textbox(label="AI-Generated or Human-Created"),
    examples=["images/ai_generated.jpg", "images/real.jpeg"],
    cache_examples=False
)

# 🧩 Full UI with Title & Tabs
with gr.Blocks(title=title) as app:
    gr.Markdown(f"# {title}")
    gr.Markdown(description)

    with gr.Tab("🎬 Video Inference"):
        video_interface.render()

    with gr.Tab("🎧 Audio Inference"):
        audio_interface.render()

    with gr.Tab("🖼️ Image Inference"):
        image_interface.render()

    with gr.Tab("🤖 AI Image Detector"):
        ai_image_detector.render()

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