Create app.py
Browse files
app.py
ADDED
|
@@ -0,0 +1,20 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
from transformers import pipeline
|
| 2 |
+
import gradio as gr
|
| 3 |
+
|
| 4 |
+
|
| 5 |
+
classifier = pipeline("image-classification", model="SADRACODING/SDXL-Deepfake-Detector")
|
| 6 |
+
|
| 7 |
+
def predict(image):
|
| 8 |
+
if image is None:
|
| 9 |
+
return None
|
| 10 |
+
results = classifier(image)
|
| 11 |
+
return {result["label"]: result["score"] for result in results}
|
| 12 |
+
|
| 13 |
+
gr.Interface(
|
| 14 |
+
fn=predict,
|
| 15 |
+
inputs=gr.Image(type="pil", label="Upload an Image"),
|
| 16 |
+
outputs=gr.Label(label="Prediction"),
|
| 17 |
+
title="🔍 SDXL Deepfake Detector",
|
| 18 |
+
description="Upload a face image to detect if it's AI-generated (deepfake) or real.",
|
| 19 |
+
examples=[]
|
| 20 |
+
).launch()
|