Spaces:
Runtime error
Runtime error
Download app.py from MockUpGenerator/image-ai: direct link, hf CLI and curl.
- Browser
- Download file 420 Bytes
-
https://huggingface.co/spaces/MockUpGenerator/image-ai/resolve/main/app.py
- Command line
-
hf download hf://spaces/MockUpGenerator/image-ai/app.py
-
curl -L -o app.py https://huggingface.co/spaces/MockUpGenerator/image-ai/resolve/main/app.py
420 Bytes
| import gradio as gr | |
| from transformers import pipeline | |
| detection_pipeline = pipeline("image-classification", "saltacc/anime-ai-detect") | |
| def detect(img): | |
| print(img) | |
| output = detection_pipeline(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() | |