anime-ai-detect / app.py
wall-e-zz's picture
Update app.py
2e789a4
raw
history blame contribute delete
394 Bytes
import gradio as gr
from transformers import pipeline
pipe = pipeline("image-classification", "saltacc/anime-ai-detect")
def detect(img):
output = pipe(img, top_k=2)
final = {}
for d in output:
final[d["label"]] = d["score"]
return final
iface = gr.Interface(fn=detect, inputs=gr.Image(type="pil"), outputs=gr.Label(label="result"))
iface.launch(enable_queue=True)