File size: 439 Bytes
ddcedb5
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
# 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"