deepfake / inference_3.py
Dharshaneshwaran
Full updated code with finding ai generated images too
ddcedb5
raw
history blame
439 Bytes
# inference_2.py
from PIL import Image
import numpy as np
def detect_ai_generated_image(img):
# if img is a path, load as array
if isinstance(img, str):
img = np.array(Image.open(img).convert("RGB"))
# 🧠 PLACEHOLDER: fake logic
# Replace with actual AI detection logic or model
mean_pixel = img.mean()
if mean_pixel > 120:
return "Possibly AI-generated"
else:
return "Likely Real"