File size: 605 Bytes
41dd38f
 
 
 
 
 
 
 
 
 
 
 
 
b6ee827
 
 
 
95f6149
41dd38f
b6ee827
41dd38f
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
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 = "BurstPixel AI Image Detector"
description = """
Check whether an image was generated using AI.\n
NB: Anything below score 60 is AI not human
"""


demo = gr.Interface(fn=image_classifier, inputs=gr.Image(type="pil"), outputs="label", title=title, description=description)
demo.launch(show_api=False)