Spaces:
Sleeping
Sleeping
Update app.py
Browse files
app.py
CHANGED
@@ -8,6 +8,7 @@ from tensorflow.keras.applications.xception import preprocess_input as xcp_pre
|
|
8 |
from tensorflow.keras.applications.efficientnet import preprocess_input as eff_pre
|
9 |
from tensorflow.keras.preprocessing.image import img_to_array
|
10 |
from huggingface_hub import hf_hub_download
|
|
|
11 |
|
12 |
# Load models
|
13 |
xcp_path = hf_hub_download(repo_id="Zeyadd-Mostaffa/deepfake-image-detector_final", filename="xception_model.h5")
|
@@ -61,3 +62,14 @@ def predict_image(image_path):
|
|
61 |
results.append({"face_id": f"face_{idx+1}", "label": label, "score": round(float(final_score), 3)})
|
62 |
|
63 |
return results
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
8 |
from tensorflow.keras.applications.efficientnet import preprocess_input as eff_pre
|
9 |
from tensorflow.keras.preprocessing.image import img_to_array
|
10 |
from huggingface_hub import hf_hub_download
|
11 |
+
import gradio as gr
|
12 |
|
13 |
# Load models
|
14 |
xcp_path = hf_hub_download(repo_id="Zeyadd-Mostaffa/deepfake-image-detector_final", filename="xception_model.h5")
|
|
|
62 |
results.append({"face_id": f"face_{idx+1}", "label": label, "score": round(float(final_score), 3)})
|
63 |
|
64 |
return results
|
65 |
+
|
66 |
+
interface = gr.Interface(
|
67 |
+
fn=predict_image, # your prediction function
|
68 |
+
inputs=gr.Image(type="filepath"),
|
69 |
+
outputs="json",
|
70 |
+
title="Deepfake Detector (Hybrid Strategy)",
|
71 |
+
description="If 1 face → predict full image. If >1 → predict each face."
|
72 |
+
)
|
73 |
+
|
74 |
+
# ✅ Required to start app
|
75 |
+
interface.launch()
|