Spaces:
Running
Running
Update app.py
Browse files
app.py
CHANGED
|
@@ -11,7 +11,7 @@ MODEL_ID = "SadraCoding/SDXL-Deepfake-Detector"
|
|
| 11 |
THRESHOLD = 0.65 # >= -> "Likely Manipulated"
|
| 12 |
IMAGE_SIZE = 224 # ViT input size
|
| 13 |
|
| 14 |
-
|
| 15 |
try:
|
| 16 |
import mediapipe as mp
|
| 17 |
_mp_face = mp.solutions.face_detection.FaceDetection(
|
|
@@ -46,7 +46,7 @@ def crop_face(pil_img, pad=0.25):
|
|
| 46 |
return pil_img
|
| 47 |
return face
|
| 48 |
|
| 49 |
-
|
| 50 |
def face_oval_mask(img_pil, shrink=0.80):
|
| 51 |
w, h = img_pil.size
|
| 52 |
mask = Image.new("L", (w, h), 0)
|
|
@@ -161,7 +161,6 @@ CUSTOM_CSS = """
|
|
| 161 |
with gr.Blocks(title="Deepfake Detector (SDXL ViT)", css=CUSTOM_CSS, theme=gr.themes.Soft()) as demo:
|
| 162 |
gr.Markdown(
|
| 163 |
"<h2 style='text-align:center;margin-bottom:6px;'>Deepfake Detector (SDXL ViT)</h2>"
|
| 164 |
-
"<p style='text-align:center;color:#6b7280;'>MediaPipe face-crop + Vision Transformer fine-tuned for artificial vs human faces.</p>"
|
| 165 |
)
|
| 166 |
with gr.Row():
|
| 167 |
with gr.Column(scale=6, elem_classes=["sleek-card"]):
|
|
|
|
| 11 |
THRESHOLD = 0.65 # >= -> "Likely Manipulated"
|
| 12 |
IMAGE_SIZE = 224 # ViT input size
|
| 13 |
|
| 14 |
+
|
| 15 |
try:
|
| 16 |
import mediapipe as mp
|
| 17 |
_mp_face = mp.solutions.face_detection.FaceDetection(
|
|
|
|
| 46 |
return pil_img
|
| 47 |
return face
|
| 48 |
|
| 49 |
+
|
| 50 |
def face_oval_mask(img_pil, shrink=0.80):
|
| 51 |
w, h = img_pil.size
|
| 52 |
mask = Image.new("L", (w, h), 0)
|
|
|
|
| 161 |
with gr.Blocks(title="Deepfake Detector (SDXL ViT)", css=CUSTOM_CSS, theme=gr.themes.Soft()) as demo:
|
| 162 |
gr.Markdown(
|
| 163 |
"<h2 style='text-align:center;margin-bottom:6px;'>Deepfake Detector (SDXL ViT)</h2>"
|
|
|
|
| 164 |
)
|
| 165 |
with gr.Row():
|
| 166 |
with gr.Column(scale=6, elem_classes=["sleek-card"]):
|