| 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_fake1.jpg"], | |
| ["example_fake2.jpg"], | |
| ["example_fake3.jpg"], | |
| ["example_fake4.jpg"], | |
| ["example_real1.jpg"], | |
| ["example_real2.jpg"], | |
| ["example_real3.jpg"], | |
| ["example_real4.jpg"], | |
| ["example_real5.jpg"] | |
| ] | |
| ).launch() |