Spaces:
Sleeping
Sleeping
Add application file
Browse files
app.py
ADDED
@@ -0,0 +1,16 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
import gradio as gr
|
2 |
+
from transformers import pipeline
|
3 |
+
|
4 |
+
detection_pipeline = pipeline("image-classification", "saltacc/anime-ai-detect")
|
5 |
+
|
6 |
+
|
7 |
+
def detect(img):
|
8 |
+
output = detection_pipeline(img)
|
9 |
+
final = {}
|
10 |
+
for d in output:
|
11 |
+
final[d["label"]] = d["score"]
|
12 |
+
return final
|
13 |
+
|
14 |
+
|
15 |
+
iface = gr.Interface(fn=detect, inputs=gr.Image(type="pil"), outputs=gr.Label(label="result"))
|
16 |
+
iface.launch()
|