quick-bright-demo / utils.py
rushkid5's picture
Deploy Gradio app with multiple files
b165dab verified
raw
history blame contribute delete
657 Bytes
from PIL import Image
import numpy as np
def is_safe_image(file_path):
"""Basic content safety check (placeholder)"""
try:
img = Image.open(file_path)
# Convert to numpy array for analysis
img_array = np.array(img)
# In a real application, this would include:
# 1. NSFW content detection
# 2. Appropriate content validation
# 3. Privacy compliance checks
# For this demo, we'll just check image dimensions
if min(img_array.shape[:2]) < 50:
return False # Reject very small images
return True
except:
return False