Downloads · 30 days
26
21% of all-time downloads
juandaram/deepfake-detector
deepfake-detector is a image classification model from juandaram. Use it when you need a label for an image. It is set up for tf-keras. The card lists the license as mit.
Este modelo detecta si una imagen es REAL o FAKE (generada/manipulada).
Downloads · 30 days
26
21% of all-time downloads
All-time downloads
121
Public
Repo size
399 MB
Likes
1
Public
Click a slice to open those files.
.data-00000-of-00001193 MB · 48%
From the Hugging Face model README
Este modelo detecta si una imagen es REAL o FAKE (generada/manipulada).
import tensorflow as tf
import numpy as np
from PIL import Image
from huggingface_hub import hf_hub_download
# Descargar modelo
model_path = hf_hub_download(
repo_id="juandaram/deepfake-detector",
filename="model.tflite"
)
# Cargar modelo
interpreter = tf.lite.Interpreter(model_path=model_path)
interpreter.allocate_tensors()
# Preparar imagen
image = Image.open("tu_imagen.jpg").convert('RGB')
image = image.resize((128, 128))
img_array = np.array(image, dtype=np.float32) / 255.0
img_batch = np.expand_dims(img_array, axis=0)
# Predecir
input_details = interpreter.get_input_details()
output_details = interpreter.get_output_details()
interpreter.set_tensor(input_details[0]['index'], img_batch)
interpreter.invoke()
output = interpreter.get_tensor(output_details[0]['index'])
prediction = "REAL" if output[0][0] > 0.5 else "FAKE"
confidence = output[0][0] if output[0][0] > 0.5 else (1 - output[0][0])
print(f"Prediction: {prediction}")
print(f"Confidence: {confidence:.3f}")
import tensorflow as tf
from huggingface_hub import snapshot_download
# Descargar modelo completo
model_dir = snapshot_download(repo_id="juandaram/deepfake-detector")
# Cargar modelo
model = tf.saved_model.load(f"{model_dir}/saved_model")
infer = model.signatures['serving_default']
# Usar igual que arriba...
Las imágenes deben:
MIT
Para preguntas o problemas, abre un issue en el repositorio.