File size: 623 Bytes
c21a2c7
 
 
 
 
 
 
 
 
9605716
c21a2c7
 
 
 
 
 
 
9605716
 
 
 
c21a2c7
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
from transformers import pipeline
import gradio as gr

classifier = pipeline("image-classification", model="SADRACODING/SDXL-Deepfake-Detector")

def predict(image):
    if image is None:
        return None
    results = classifier(image)
    return results[0]["label"]

gr.Interface(
    fn=predict,
    inputs=gr.Image(type="pil", label="Upload an Image"),
    outputs=gr.Label(label="Prediction"),
    title="πŸ” SDXL Deepfake Detector",
    description="Upload a face image to detect if it's AI-generated (deepfake) or real.",
    examples=[
        ["example_real.jpg"],
        ["example_fake.jpg"]
    ]
).launch()