File size: 494 Bytes
a9ebad8
 
 
 
 
 
 
 
 
 
 
 
9ac58e0
a9ebad8
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
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

demo = gr.Interface(fn=image_classifier, title = "Interface", examples=["Example1.jpg", "Example2.jpg", "Example3.jpg", "Example4.jpg"], inputs=gr.Image(type="pil"), outputs="label")
demo.launch()