Spaces:
Sleeping
Sleeping
import gradio as gr | |
from transformers import pipeline | |
pipe = pipeline("image-classification", "umm-maybe/AI-image-detector") | |
def image_classifier(image): | |
outputs = pipe(image) | |
results = {} | |
for result in outputs: | |
results[result['label']] = result['score'] | |
return results | |
title = "AI Generated Human Image Detector" | |
description = """ | |
This demo detects whether a given human image is real or is generated by AI. | |
Instruction: | |
1. Select a sample image from the "Real" folder and Submit | |
2. Select a sample image from the "Fake" folder and Submit | |
""" | |
demo = gr.Interface(fn=image_classifier, inputs=gr.Image(type="pil"), outputs="label", title=title, description=description) | |
demo.launch(show_api=False) | |