| 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() |