MetaQu's picture
Update app.py
7051165 verified
raw
history blame
491 Bytes
import gradio as gr
from PIL import Image
from transformers import pipeline
# Muat model deteksi AI
classifier = pipeline("image-classification", model="umm-maybe/AI-image-detector")
def detect_image(image: Image.Image):
result = classifier(image)
ai_score = result[0]['score'] if result[0]['label'] == 'AI-generated' else 0
return f"Skor AI: {ai_score:.2f}"
# Antarmuka Gradio
iface = gr.Interface(fn=detect_image, inputs=gr.Image(type="pil"), outputs="text")
iface.launch()